How to distribute an open-source jar with dependencies?

dependency-management, jar, java, software-distribution

Solution

You shouldn't include dependencies into your jar. Just declare them as maven dependencies.

This will give several advantages:

Users can use your library in conjunction with standalone Guava of any backward compatible version.

User can reduce dependencies count by excluding Guava transitive dependency from your library if he uses parts of your library, that don't depend on Guava.

Problem

I'de like to distribute a Java package that I've written under some permissive license. The resulting `speedytools-0.1.jar` has some common Java dependencies like Apache Commons and Guava. What is the most Java-esque way to distribute this jar? Should I include the dependencies in my distributed zip file?

Original source