Reuse property value for other property name

112 views Asked by At

I've a question about ANT property.

I want to do this :

<var name="index" value="1"/>
<for param="XXX">
....
<loadproperties prefix="${index}">
    <zipentry zipfile="@{XXXX}" name="YYYY"/>
        <filterchain>
            <linecontains>
                <contains value="ZZZZZ"/>
            </linecontains>
        </filterchain>
</loadproperties>
<echo message="${${index}.ZZZZZ}"/>
....
<math result="index" operand1="${index}" operation="+" operand2="1" datatype="int" />

The problem is to reuse the "index" variable to display the desired property . Is it possible to do that in ANT ? Thank you :)

1

There are 1 answers

0
JMA On BEST ANSWER

I found the solution ...

//use this
<appendProperty prop="implversion" data="${index}.ZZZZZ" />  
//don't forget to set that
    <macrodef name="appendProperty">
               <attribute name="prop" default="" />
               <attribute name="data" default="" />
               <sequential>
                       <var name="@{prop}" value="${@{data}}" />
               </sequential>
    </macrodef>