I have developed an Iterate task that allows you to iterate (loop). I've
submitted it to the project, but haven't got a reply yet...
Here is the email that I sent to the development group.
Ant does not support iteration or loop mechanisms that allows you to repeat
certain processes. Without such a mechanism, repeat processes have to be
hard coded, one entry in the build script per occurrence. This is less than
desirable because as it requires the modification of the build script each
time the project changes.
An iteration Java task has been developed which better supports the repeat
processes in the build.
Note: We had to use the standard Ant package names because the custom task
requires access to certain protected functions in classes in the Ant
This new task repeatedly calls a target passing different values from a
The above example will call the hello target three times, each time passing
a value from the item list. In this case the hello target will echo 1, then
3 and then 5.
A more useful example is the ability to compile multiple source directories
into multiple jar files.
The above example does the following:
. Compiles the myModule/src directory into
. Compiles the myModule/mySubModule/src directory into
I have included the source, classes and a example build script that calls
the new task.
From: Manik Surtani [mailto:firstname.lastname@example.org]
Sent: 12 November 2001 15:04
Subject: Looping in ANT
I have noticed a problem with ant, and that is performing loops.
If I want a set of tasks to repeat several times based on a set of
properties, the only way I can do this is using the
really takes away from the whole ANT XML build script thing.
My current J2EE build script runs almost everything in a loop, so this
Is there an alternate way to do this?
Also, who is the maintainer of the