Thanks Friends,
I really appreciate your help.
Cheers
On 7/3/07, ryan@ryano.us <ryan@ryano.us> wrote:
>
> Not sure about the props file question but can you use a variable.
> Something like below:
>
> <target name="testme">
> <var name="counter" value="0"/>
> <for list="a,b,c" param="argvalue" >
> <sequential>
> <math result="counter" operand1="${counter}" operation="+" operand2="1"
> datatype="int"/>
> <echo>counter: ${counter}</echo>
> <if>
> <equals arg1="${counter}" arg2="1"/>
> <then>
> <echo message="value is 1"/>
> </then>
> <else>
> <echo message="value is NOT 1"/>
> </else>
> </if>
> </sequential>
> </for>
> </target>
>
> Echos the following:
> testme:
> counter: 1
> value is 1
> counter: 2
> value is NOT 1
> counter: 3
> value is NOT 1
>
> hth.
> -ryano
>
> ----- Original Message -----
> From: "broken connection"
> To: "Ant Users List"
> Subject: Help with iteration in for loop
> Date: Tue, 3 Jul 2007 09:57:37 -0400
>
>
> Hi Friends,
> Is there any way to control iteration in ant. I want to put an
> if-else
> condition in the for loop to control the action depending upon the
> iteration
> count.I tried this:
>
> build.xml
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> counter: ${count}
>
>
>
>
>
>
>
> value.properties file:
> count=0
>
> After I execute this,I get this as output:
>
> C:\Documents and Settings\Desktop\test>ant
> Buildfile: build.xml
>
> test_iteration:
> [propertyfile] Updating property file: C:\Documents and
> Settings\hjhutty\Desktop
> \test\value.properties
> [echo] counter: 0
> [propertyfile] Updating property file: C:\Documents and
> Settings\hjhutty\Desktop
> \test\value.properties
> [echo] counter: 0
>
> BUILD SUCCESSFUL
> Total time: 1 second
>
> value.properties=2
>
> Can somebody explain me,why ${count} still displays 0 in the second
> iteration,though the properties file has been updated.
>
> Please help.
> Thanks
>
|