Question

When you start to use a third party library in Java, you add their jars to your project. Do you also add the jars to the repository or do you just keep a local installation. And if the latter, how do you sync between team members to be able to work?

Thanks.

Was it helpful?

Solution

No, if you use Maven. Put them into Maven repository (if they are not there yet, most open source libraries are in public Maven repositories already).

Yes, if you use Ant.

OTHER TIPS

Yes. You should add to the repository whatever is required for a developer on a clean system (aside from having the JDK and ant installed) to check out and build the project.

If you're using ANT and you want maven style dependency management without maven, take a look at Ivy. It can download from maven repositories and can even read maven pom files.

Yes, third-party libraries should be version controlled since you will want everyone to compile against the same version of that library. This way when updates to that third-party library happen you will simply have to change it in one place and everyone will update to the new version. Otherwise you could easily end up with the famous: "It compiles on my machine!"-syndrome.

Assuming you do not use Maven, then you should definitely check in versions of 3rd party jars. You (or more importantly, the maintenance developer coming along after you) should be able to pull a version of your application from the repository and have all the correct versions of all the 3rd party jars required at compile- and runtime.

You also should maintain the versioning history of the 3rd party jars, again to help the maintenance developer out. Checking them in to the repository is the easiest and most effective way to do this.

I would recommend versioning everything you need to build a project. Unless your using a build tool like maven.

Short Answer

No

Longer answer

In the interim, use a folder on your network separate from the repo.

A Long Term Solution

Use maven. It was built for handling your build, configuration and external jar dependencies.

Go here for documentation though. (The official maven documentation is known to be pretty spotty).

Lately I've been keeping JARs out of SVN. I have a separate repository that I use to pull them into projects, manage dependencies, and keep track of different versions.

This is what Maven is born for. I've got to learn how to use it well, but until then I'm keeping my own JAR repository.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top