Use the for Task of the antcontrib Extension for Ant.

Download: http://sourceforge.net/project/showfiles.php?group_id=36177

Tasks: http://ant-contrib.sourceforge.net/tasks/tasks/index.html

You need to add antcontrib using the taskdef task (sometimes more tricky than 
it should), sth. Like:
  <!-- antcontrib Tasks (z.B. for-Task)-->
  <taskdef resource="net/sf/antcontrib/antlib.xml">
    <classpath>
      <pathelement location="${ant.contrib.jar}" />
    </classpath>
  </taskdef>


Here is a sample from the manual:

Example:
  <!-- Reiner Testtarget für den for Task -->
  <target name="testfor">
    <for list="a,b,c,d,e,1" param="letter" parallel="false">
      <sequential>
        <echo>Letter @{letter}</echo>
      </sequential>
    </for>
  </target> 


-- 
Jürgen Knuplesch                    www.icongmbh.de
icon Systemhaus GmbH                Tel. +49 711 806098-275
Sophienstraße 40                    
D-70178 Stuttgart                   Fax. +49 711 806098-299

Geschäftsführer: Uwe Seltmann
HRB Stuttgart 17655
USt-IdNr.: DE 811944121 
-----Ursprüngliche Nachricht-----
Von: arijit [mailto:[EMAIL PROTECTED] 
Gesendet: Mittwoch, 20. Juni 2007 16:19
An: [email protected]
Betreff: Using for loop


I am trying to dynamically generate build2.xml by executing build1.xml. I have 
a build2_template.xml file and a property file. build2.xml is generated by 
reading the build2_template.xml and providing inputs to it through the property 
file.

a series of similar code needs to be written in build2.xml file which is a 
repititive work. So I was thinking of using some for - loop to write codes like 

<property name="testN" value="TEST-N"/>

in build2_template.xml

where N could be from 1 to some value which is defined in the property file.
the property file is loaded in build1.xml

Any suggestion ?


--
View this message in context: 
http://www.nabble.com/Using-for-loop-tf3952686.html#a11214404
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to