0

I have a scenario, where using ANT Script I have to fetch codes from SVN using properties file.

The properties files has the property projectlib where the libraries used in a module are listed as comma separated values and their corresponding revision numbers are listed in a property projectlib.revision below.

I have to fetch projectlib with the respective revision number.

The properties file looks as below:

projectliblist=XXXXLib1,XXXXLib2
projectlibrevision=3195,3289    

For Example, here I have to fetch XXXXLib1 from 3195 and XXXXLib2 from 3289.

I need the logic to match projectlib with respective revision number, not the complete script for this scenario.

I tried with For list, but I don't know how to index the param list.

Ethaan
  • 11,291
  • 5
  • 35
  • 45
Balas
  • 1
  • Since this is Ant, I assume this is Java and you're trying to associate Jar files? Is this correct? If it is, you should look into using [Ivy](http://ant.apache.org/ivy) or [Maven](http://maven.apache.org). Ivy works with Ant, so if you already have a `build.xml`, incorporating Ivy into your current build isn't too difficult. This usually works better than writing your own library management schemes. – David W. Apr 14 '15 at 18:41

1 Answers1

0

The problem you will have with the pair of list properties you show is that (at least using ant-contrib:for) you don't have a way to cross-refer them.

This answer shows how you can readily cross refer properties using ant-contrib:for / macrodef and might be useful as an example.

For your case, I'd suggest you change the properties structure to be more consumable in Ant, for example:

projectliblist=XXXXLib1,XXXXLib2
projectlib.XXXXLib1.revision=3195
projectlib.XXXXLib2.revision=3289  

which you could consume following the pattern in the answer I linked to above, or possibly:

projectliblist=XXXXLib1/3195,XXXXLib2/3289  

which you could consume in a loop which splits each list element into two parts and passes to a macrodef with two attributes.

Community
  • 1
  • 1
ewan.chalmers
  • 16,145
  • 43
  • 60