ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Difficulty in foreach
Date Thu, 27 Apr 2006 05:28:32 GMT
Hi friends,
I'm new to this mail group and also new to ant script.
I have a problem while using foreach in ant.  Im having ant 1.5.3 version. 

The following is the script 

        <target name="wsc.MessagingBridges.create">
                <var name="i" value="0" unset ="true"/>
                <var name="j" value="1" unset ="true"/>
                        <echo>The loop starting ${i} ${j}</echo>
                        <forEach list="${JMSBridgeDest_Nos}" 
                <echo>For Loop ends</echo>

        <target name="wsc.MessagingBridge.create">
                <echo>Creating Bridge </echo>
                <echo>${i} ${j}</echo>
                <math result="jdb_src1" operand1="${JMSBridge}" 
operand2="${i}" operation="+" datatype="int"/>
                <math result="jdb_src2" operand1="${JMSBridge}" 
operand2="${j}" operation="+" datatype="int"/>
                <echo>${JMSBridge_Nr} ${jdb_src1} ${jdb_src2}</echo>
                <propertycopy name="JMSBridge" 
from="JMSBridge${JMSBridge_Nr}" silent="false"/>
                <propertycopy name="jbd_source1" 
from="JMSBridgeDestName${jdb_src1}" silent="false"/>
                <propertycopy name="jbd_source2" 
from="JMSBridgeDestName${jdb_src2}" silent="false"/>
                <propertycopy name="DestJNDIName" 
from="DestJNDIName${JMSBridge}" silent="false"/>
        <echo>Finished Bridge.</echo>
        <math result="i" operand1="${i}" operand2="1" operation="+" 
        <math result="j" operand1="${j}" operand2="1" operation="+" 
        <echo> ${i} ${j}</echo>

    The value of JMSBridgeDest_Nos which I'm loading from a properties 
file contains 1,2. I want the target "wsc.MessagingBridge.create" to 
iterate twice. The iteration is working fine. I'm having another 2 
variables i and j which I want ed to increment and to passed to target 
"wsc.MessagingBridge.create" in each iteration. I tried the above code but 
the values of i and j never changes. 
  Can anyone help me regarding this. 
    In each iteration I want the value of i and j to be dependant on 
For eg. 
if JMSBridgeDest_Nr = 1 then i = 1 and j =2
if JMSBridgeDest_Nr = 2 then i = 3 and j = 4

Thanks in advance.

Abdul K Jameel
Tata Consultancy Services Limited
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message