I'm attempting to use a property as a template for multiple other properties, but it only works the first time. It's probably easiest to show by example, so I've cut down my code to a minimal case that exhibits this behaviour:
<target name="test">
<property name="individual.template" value="x@ID@"/>
<propertyregex property="individual.1" input="${individual.template}" regexp="\@ID\@" replace="1" global="true" override="true"/>
<echo>====== ${individual.1} ::: ${individual.template}</echo>
<propertyregex property="individual.2" input="${individial.template}" regexp="\@ID\@" replace="2" global="true" override="true"/>
<echo>====== ${individual.2} ::: ${individual.template}</echo>
<propertyregex property="individual.3" input="${individial.template}" regexp="\@ID\@" replace="3" global="true" override="true"/>
<echo>====== ${individual.3} ::: ${individual.template}</echo>
<propertyregex property="individual.4" input="${individial.template}" regexp="\@ID\@" replace="4" global="true" override="true"/>
<echo>====== ${individual.4} ::: ${individual.template}</echo>
<propertyregex property="individual.5" input="${individial.template}" regexp="\@ID\@" replace="5" global="true" override="true"/>
<echo>====== ${individual.5} ::: ${individual.template}</echo>
</target>
I would expect this to output x1, x2, etc., but it outputs the following:
[echo] ====== x1 ::: x@ID@
[echo] ====== ${individual.2} ::: x@ID@
[echo] ====== ${individual.3} ::: x@ID@
[echo] ====== ${individual.4} ::: x@ID@
[echo] ====== ${individual.5} ::: x@ID@
As you can see it's ok for the first one, but the next properties are simply not set. I thought at first that the template property was modified, but as you can see from the output, that's not the case. Am I just doing something silly here? Is this not supported? Or is it a bug? Any ideas would be greatly appreciated.
(Ant version 1.8.2, ant-contrib version 1.0b2).
@thor84no, I see a copy/paste error in the test case: Shouldn't you be printing the value of individual.1/individual.2/individual.3/individual.4/individual.5
instead of individual.template
? I made these changes locally and the output is what you had expected:
test:
[echo] ====== x1 ::: x1
[echo] ====== x2 ::: x2
[echo] ====== x3 ::: x3
[echo] ====== x4 ::: x4
[echo] ====== x5 ::: x5