I just finished setting up a multi-project Ant build system and thought I'd blog about it.

My build requirements were exactly what http://www.exubero.com/ant/dependencies.html described, so I followed the recommendations pretty much to the letter.

However, it bombed in one area. One of my projects had a sub-folder where there were sub-projects and I called their respective ant files using subant. However, the sub-projects' basedir was always set to the super project's basedir and the build never completed properly.

Turns out there's a problem mixing ant and subant (in Ant 1.7.1).

Workaround was simple but finding the problem took me 4 hours. Instead of something like this in dependencies.xml,

<target name="depend.model" depends="depend.utilities">
<ant dir="${dependencies.basedir}/model" inheritAll="false"/>
</target>

do this instead

<target name="depend.model" depends="depend.utilities">
<subant inheritAll="false">
<fileset dir="${dependencies.basedir}/model" includes="build.xml"/>
</subant>
</target>

The subant task is a superset of the ant task so it should be a dropin replacement.