Reputation: 14421
I'm working on a library that has it's own library dependencies, that I want to abstract away from. I'm running into problems after exporting my project to a jar that has the structure of:
Foo.jar
-> net
-> foo
-> java class files
-> lib
-> *.jar
-> src
-> foo
-> java source files
-> doc
-> javadoc and other docs
-> License.txt
When I go to test my library, I can easily import my library code from net.foo.*
but get exceptions thrown when I run because of "no suitable driver for ..." and others dependent on the internal library being called from my abstraction layer.
I'm using ANT to build my jar, but am not sure what to do. Ideally the user would just add my jar to their build path and then import my packages.
Upvotes: 0
Views: 412
Reputation: 18458
You are shipping a library that has set of dependencies. The users of library has the option of adding the dependency libraries. If I understood correctly, you want to make it simple for user by including the dependency jars are part of your library jar. You can merge many jars into single jar using JarJar.
From the site..
Jar Jar Links is a utility that makes it easy to repackage Java libraries and embed them into your own distribution. This is useful for two reasons:
You can easily ship a single jar file with no external dependencies.
You can avoid problems where your library depends on a specific version of a library, which may conflict with the dependencies of another library.
If this is about repackaging for executable jar , then look for One-Jar. Discussed here in Easiest way to merge a release into one JAR file
Upvotes: 1