Reputation: 4942
I need a build file which builds a java project called A. The project A has a dependency to the java project B. The dependency is defined via Eclipse IDE:
Project A -> Properties -> Java Build Path -> Tab Project -> Add -> B
My questions according how to achieve this project build are:
Upvotes: 2
Views: 4307
Reputation: 107040
This isn't purely an Ant issue. The question is how do you get this dependency (which I assume is a Jar).
You setup your Ant build.xml
script to check for this dependency in a particular location, and not try to do a build if its not there.
However, the best way to do this is to use Ivy to handle these types of dependencies. Ivy works with Ant to handle dependency management and actually work with another build/dependency system called Maven.
The nitty gritty of this whole affair is this:
ivy.xml
file that tells the project that it depends upon this artifact.It all sounds simple, except that Ivy's on line documentation is pretty bad. I highly recommend Manning's Ant in Action by Steve Loughran and Erik Hatcher. They have an excellent chapter on using Ivy. If you use Ant, I highly recommend using Ivy. And, there's an Ivy plugin for Eclipse too.
Upvotes: 4