我有一个关于ANT属性的问题。
我想这样做:
<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" />
问题是重用"index"变量来显示所需的属性。是否可以在ANT中做到这一点?谢谢:)
我找到了解决方案...
//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>