Search code examples
gitjarrepositorygit-commitexternal-dependencies

Commiting external dependencies with Git


I have tried to added external lib to myProject/libs/externalLib.jar or myProject/src/main/resources/libs/externalLib.jar folders but I can't commit them to repository.

What's the best way to manage external dependencies - jar libs? How to commit them to Git repository?


Solution

  • The best way to manage external JAR dependencies is to not version them using Git. Instead, each developer on your team should use a local set of JAR depedencies when building. To give an example, if you were using Maven to manage your build, then you would commit your pom.xml file to Git. Then, when you add or remove a depedency you would push pom.xml to the repository. Every other developer would then learn about this new depedency by pulling a single small file.