3

I have properties file that contains two list.

listA=A1,A2,A3
listB=B1,B2,B3

In my build file I am trying to get the value from both list at the same time, meaning if I am getting 2nd value from listA and then I should get the 2nd value from listB. I couldn't find anything like index in ant. My for loop looks like below it works but for loop run 6 times.

<for list="${listA},${listB}" param="temp">
        <sequential>
            <echo>temp ${temp}</echo>
        </sequential>
</for>

Output :

temp A1
temp A2
temp A3
temp B1
temp B2
temp B3

Is there any way to read both list at the same time and get values in two different variables

Ideally I am trying to achieve is something like below

<for list="${listA},${listB}" param="tempa,tempb">
    <sequential>
        <echo>tempa ${tempa} , tempb ${tempb}</echo>
    </sequential>
</for>

which should return following Output :

temp A1 , temp B1
temp A2 , temp B2
temp A3 , temp B3
Nakul Detroja
  • 61
  • 1
  • 6
  • Take a look at [How can I use something like an array or list in Ant?](http://stackoverflow.com/questions/7308517/how-can-i-use-something-like-an-array-or-list-in-ant). You can adapt the solution to that question with logic that creates a property if `index` equals `2`. – Chad Nouis Oct 20 '16 at 14:28
  • I looked at the solution before posting the question and I am not sure if I totally understand what you are suggesting but ideally what I want is something like below. Loop should only run three times and each time inside the loop I should be able to use the value from both list. Output : temp A1 temp B1 temp A2 temp B2 temp A3 temp B3 – Nakul Detroja Oct 20 '16 at 14:35

0 Answers0