Ant dependency management

ant

It seems that ant dependency management isn't great to say the least… But, is there hope?
Today there are better choices for build or project management such as maven, ivy but I'm stuck with a bunch of ant project that depend on one another so I was wondering if there's an "ant best practice" for managing dependencies.

Specifically in my case I have:

w.war

a.jar
b.jar
c.jar

w.war is the war file I deploy to the web server. In the war file I use a.jar. a.jar depends on b.jar, so I happily package b.jar into w as well… That's sort of OK until…
The problem starts when b.jar depends on c.jar. The author of a.jar knows about its dependency on b.jar so it can package b.jar into w.war, but it is not aware of the dependency of b.jar on c.jar. Moreover, the author of b.jar could later add even more dependencies such as "b.jar depends on e.jar", so the author of a.jar has no chance following these dependencies as they add up.

What I'd like to have is define "a depends on b" and "b depends on c" (in a different build.xml file) and use ant magic to compile them all into w.war.
Is that possible? If not, is there a Best-Practice?

I'm this-close to just rewriting is all in maven, but it's a lot of work… Is there hope to ant?

Best Solution

If you already use Ant, then your best bet is to use Ivy for dependency management.

http://ant.apache.org/ivy/

It provides a rich set of ant tasks for dependency manipulation.

Related Question