You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Tom Rynne <to...@net-imps.com> on 2000/11/09 12:20:54 UTC

foreach task

Hi,
  Is there any way to do a for-each type construct in ant?
I'm writing a build script to compile a project which is broken into 'modules'
so there are java packages
<application>.<module>.eejb
<application>.<module>.sejb
<application>.<module>.tags
                                     ...
for each module.
I've written a build script which creates the relevant jars for a module.
using a property named 'module'.
I'd like to have a build script which then generates each module
I thought I could use
<property name="module" value="module1"/>
<ant antfile="build-module.xml" target="all"/>
<property name="module" value="module2"/>
<ant antfile="build-module.xml" target="all"/>
...
but properties can be changed. Ideally I'd use a foreach task
which runs <ant ..> on a list of module names
any suggestions?

thanks
Tom


Re: foreach task

Posted by Stefan Bodewig <bo...@bost.de>.
Tom Rynne <to...@net-imps.com> wrote:

> I thought I could use
> <property name="module" value="module1"/>
> <ant antfile="build-module.xml" target="all"/>
> <property name="module" value="module2"/>
> <ant antfile="build-module.xml" target="all"/>
> ...

make that

<ant antfile="build-module.xml" target="all">
  <property name="module" value="module1"/>
</ant>

<ant antfile="build-module.xml" target="all">
  <property name="module" value="module2"/>
</ant>

Cheers

        Stefan