tags:

views:

85

answers:

2

From my main build file, I would like to call the same target in multiple other build files. My current solution is to call them separately, like so:

<ant antfile="${lib_src_dir}/mylib1/build.xml" target="build" inheritAll="false"/>
<ant antfile="${lib_src_dir}/mylib2/build.xml" target="build" inheritAll="false"/>

I would like my build file to just call the build target on the build files in all of the subdirectories of ${lib_src_dir}. I know I could use the foreach tasks from ant-contrib, but I'd like to stay away from an external library if possible.

I've tried the following, which didn't work:

<ant antfile="${lib_src_dir}/*/build.xml" target="build" inheritAll="false"/>
+2  A: 

You want the subant task.

ChrisH
Hah, I just noticed your comment above.
ChrisH
A: 

Here's what I ended up with, using the subant task:

<subant target="clean">
    <fileset dir="${lib_src_dir}" includes="*/build.xml" />
</subant>
scompt.com