tags:

views:

233

answers:

1

Hi,

I'm writing an Ant script and I like to call a macro multiple times using arguments from a list in a property file. The format of the property file is not important, it will be manually edited prior to Ant invocation. I'v been thinking about AntCall, SubAnt, RegExpMapper etc. but I'm simply not experienced enough in Ant to put it all together, any suggestions are wellcome!

E.g. property file:

list = "a/b/c,d/e/f,g/h/i"

Executed by Ant:

<myMacro A="a" B="b" C="c" \>

<myMacro A="d" B="e" C="f" \>

<myMacro A="g" B="h" C="i" \>

Thanks, Mats

+1  A: 

You can read properties from a file with the normal Property task:

<property file="foo.properties"/>

The format of this file follows the normal Java properties file.

To separate the values you might have a look at the PropertySelector and PropertyRegex tasks in ant-contrib (http://ant-contrib.sourceforge.net). Here you need to do some regex magic to extract the individual values from your list.

akr
OK! Also found some good leads at http://www.jguru.com/faq/view.jsp?EID=1099123Combining it with your answer I solved the problem!:-) // Mats
Mats Karrman