我有以下Ant脚本:
<target name="make-ears">
<for list="1,2,3,4" param="clone-nr">
<sequential>
<!-- Do stuff -->
</sequential>
</for>
</target>
我更喜欢使用以下方式动态设置大小:
<property name="nr_clones" value="4" />
有类似的东西:
<for list="**1 to ${nr_clones}**" param="clone-nr"> <!-- ** Not working but would like to ** -->
答案 0 :(得分:0)
通过使用Javascript:
解决了这个问题<property name="nr_clones" value="4" />
<!-- Build list -->
<script language="javascript">
<![CDATA[
var start = 1;
var end = FileToJRKScheduler.getProperty("nr_clones");
var list = start;
for (i = parseInt(start) + 1; i <= end; i++) {
list += "," + i.toString();
}
FileToJRKScheduler.setProperty("list_clones", list);
]]>
</script>
然后使用:
<for list="${list_clones}" param="clone-nr">
致谢:https://eureka.ykyuen.info/2014/01/17/apache-ant-iteration-within-a-specific-number-range/