我需要做500次循环。是否有更好的方式,而不是
<property name="javato.activetesting.trialnum.list" value="0,1,2,...,500(terrible)" />
<for param="trialnum" list="${javato.activetesting.trialnum.list}">
<sequential>
<echo message="Sub-iteration:@{trialnum}" />
<echo message="................" />
</sequential>
</for>
我不确定如何推进这个 - 任何建议?
答案 0 :(得分:0)
Antelope还有一个名为repeat的额外任务,可以像这样使用:
<taskdef name="repeat" classname="ise.antelope.tasks.Repeat"/>
<repeat count="2" interval="1" unit="milliseconds">
<echo>${count}</echo>
</repeat>
还从另一个问题找到this解决方案:
<target name="example4">
<property name="n" value="3300"/>
<property name="target" value="callee"/>
<property name="param" value="calleeparam"/>
<script language="javascript">
// does n antcall's with iteration number param
var n = parseInt(project.getProperty("n"),10);
for (var i = 0; i < n; i++) {
var t = project.createTask("antcall");
t.setTarget(project.getProperty("target"));
var p = t.createParam();
p.setName(project.getProperty("param"));
p.setValue(""+i);
t.perform();
}
</script>
</target>