Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / June 2007

Tip: Looking for answers? Try searching our database.

Loop in Ant?

Thread view: 
vunet.us@gmail.com - 06 Jun 2007 15:48 GMT
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.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.