We have a bunch of Ant scripts, one for each of our subprojects. In the end we want to run all of these from a master build script and do some other housecleaning to package the whole project. Each of the individual Ant scripts is named ant.xml
and is in the subdirectory of its project. Each uses an Ant import
to import an ant-commons.xml
, and then overrides some of the specific targets there.
For example, one of the projects overrides the compile
target, to set the classpath
appropriately, and to set the source
and target
to 1.5 (the ant-commons uses 1.4)
Now, in theory, this all sounds easy. Here's the master build script:
<project name="Retain" basedir="." default="main">
<target name="main">
<ant dir="SharedJava" antfile="ant.xml" target="clean"/>
<ant dir="SharedJava" antfile="ant.xml" target="copy_current"/>
<ant dir="GWEasySoap" antfile="ant.xml" target="clean"/>
<ant dir="GWEasySoap" antfile="ant.xml" target="copy_current"/>
<ant dir="RetainLib" antfile="ant.xml" target="clean"/>
<ant dir="RetainLib" antfile="ant.xml" inheritAll="false" target="copy_current"/>
<ant dir="RetainIndex" antfile="ant.xml" target="clean"/>
<ant dir="RetainIndex" antfile="ant.xml" target="copy_current"/>
<ant dir="RetainPersist" antfile="ant.xml" target="clean"/>
<ant dir="RetainPersist" antfile="ant.xml" target="copy_current"/>
</target>
</project>
What actually happens:
The first few subprojects run fine. RetainLib
, which, in fact, needs to have a reference to the SharedJava
's jar, then fails, whining about how it cannot find it. When I removed RetainLib
, RetainIndex
failed, whining about how you shouldn't use generics in a 1.4 target file.
After playing around I determined quite simply these were insisting on running the compile target inside ant-commons
instead of the overridden one.
Why? How can I get around this? (Elegantly I mean - obviously I could remove the use of ant-commons altogether and I bet things would work.)