It would be a nice feature to be able to include build files within other build files. This would work similarly to antcall, but would allow you to specify targets within another xml file. For example: if I had a build file that setup some necessary environment information, I could include that file in all of my build files. In the attached xml files, build.xml calls common.xml to set a commonly used property.
I have a patch that does this. It is called CallTargetExternal, and is based loosely on CallTarget.java which implements antcall. This task imposes the restriction that you must maintain unique target name across all of the xml files that are called. This limitation could be avoided with a little more work in Project.java, but I'm not sure that it is worth it. What does everyone think? Zack
CallTargetExternal.java
Description: java/
<project name="CommonProject" default="common" basedir=".">
<target name="common">
<property name="foo" value="bar" />
<echo message="Build classpath ${java.class.path}" />
</target>
</project>
<project name="MyProject" default="foo" basedir=".">
<!-- set global properties for this build -->
<target name="foo" depends="check">
<antinclude file="/build/common.xml" target="common" />
</target>
</project>
