3
我是新来的Ant,我有一个场景来分配当前时间,我已经[1],创建一个文件夹[2],然后向下添加一些文件文件到文件夹[3]。所以我需要获得我在[2]中获得的时间价值。我基本上是一个java的家伙,如果它是在java中,那么有几秒钟的工作就有一个全局变量并重新使用它。但在这里,我不确定如何在不同的目标标签中全局重用值。请分享你的想法。如何赋值给变量并重用它蚂蚁
[1]
<macrodef name="set.timestamp">
<sequential>
<tstamp>
<format property="current.time" pattern="MM-dd-yyyy_hh-mm-ss"/>
</tstamp>
</sequential>
</macrodef>
[2]
<target name="init" depends="setRuntimeArchive">
<set.timestamp/>
<mkdir dir="${results}/${classname}_${current.time}/xml" />
<mkdir dir="${results}/${classname}_${current.time}/html" />
<mkdir dir="${junit-report-output}" />
</target>
[3]:我在这里无法得到current.time值相同正如我上面[2]
了<target name="runTestResults">
<copy
file="${eclipse-home}/${report}.xml"
tofile="${results}/${classname}_${current.time}/xml/${report}_${platform}.xml"
failonerror="false" />
<xslt
style="${etf-home}/plugins/${org.eclipse.test}/JUNIT.XSL"
basedir="${results}/${classname}_${current.time}/xml"
destdir="${results}/${classname}_${current.time}/html" />
<antcall target="runTestStatus" />
</target>
你可以发布你的整个蚂蚁脚本?这可能与您的任务执行顺序有关。也许runTestResults不依赖于init,所以'set.timestamp'宏从不被调用? – David