How do I loop in Ant?
I have a <property name='xxx' value='yyy'/> where I have a set of
targets to perform for value 'yyy'. But I want to have an array of
'yyy' values, i.e. to perform the same set of commands for different
values of the property or loop through values.
Thanks.
Daniel Dyer - 06 Jun 2007 15:57 GMT
> How do I loop in Ant?
>
[quoted text clipped - 4 lines]
>
> Thanks.
Ant doesn't really support this. You can declare a macro so that you can
perform the same tasks for different inputs.
http://ant.apache.org/manual/CoreTasks/macrodef.html
Alternatively, you can download the Ant contrib tasks. These include a
foreach task.
http://ant-contrib.sourceforge.net/tasks/tasks/index.html
Dan.

Signature
Daniel Dyer
http://www.uncommons.org
Andy Dingley - 07 Jun 2007 12:56 GMT
On 6 Jun, 15:48, vunet...@gmail.com wrote:
> How do I loop in Ant?
You don't. In an attempt to force declarative coding style over
procedural, Ant is deliberately (if not perhaps correctly) light on
control structures to do this.
If your set if file-related, then you might be apply to use Apply (Ant
1.7+)
Otherwise there's a foreach task from ant-contrib, but this limits
easy deployment of your Ant buildfile to other Ant installations that
might not have this task installed.