以下是我的蚂蚁脚本:
<project name="nightly_build" default="main" basedir="C:\Work\6.70_Extensions\NightlyBuild">
<target name="init">
<sequential>
<exec executable="C:/Work/Searchlatestversion.exe">
<arg line='"/SASE Lab Tools" "6.70_Extensions/6.70.102/ANT_SASE_RELEASE_"'/>
</exec>
<property file="C:/Work/latestbuild.properties"/>
<sleep seconds="10"/>
<echo message="The product version is ${Product_Version}"/>
<exec executable="C:/Work/checksnapshot.exe">
<arg line='"ANT_SASE_RELEASE_${Product_Version}_SASE Lab Tools-NightlyBuild" ANT_SASE_RELEASE_${Product_Version}_AnalyzerCommon-NightlyBuild ${Product_Version}-AppsMerge' />
</exec>
<property file="C:/Work/checksnapshot.properties"/>
<tstamp>
<format property="suffix" pattern="ddMMyyyyHHmm"/>
</tstamp>
</sequential>
</target>
<target name="main" depends="init">
<echo message="loading properties files.." />
<sleep seconds="10"/>
<echo message="Backing up folder" />
<move file="C:\NightlyBuild\NightlyBuild" tofile="C:\NightlyBuild\NightlyBuild.${suffix}" failonerror="false" />
<parallel>
<exec executable="C:/Work/sortfolder.exe">
<arg line="6" />
</exec>
<exec executable="C:/Work/6.70_Extensions/NightlyBuild/antc.bat">
</exec>
</parallel>
</target>
</project>
基本上顺序是这样的:
Searchlatestversion.exe
并撰写latestbuild.properties
latestbuild.properties
我将获得${Product_Version}
,并希望允许checknapshot.exe访问latestbuild.properties
并获取${Product_Version}
checksnapshot.exe
将生成checksnapshot.properties
,然后主要antc.bat
${Product_Version}
醇>
我在这做错了吗? checksnapshot.exe
似乎没有很好地收到{{1}}
答案 0 :(得分:1)
Searchlatestversion
您的文件似乎有一个10秒的硬编码等待时间来写出您的文件。如果可执行文件未在该时间内完成,则无法从文件中读取${Product_Version}
。
您是否考虑过使用Waitfor Ant任务?顾名思义,这将等待某个条件,然后才能继续执行其余任务。你可以做点什么
<property name="props.file" value="C:/Work/latestbuild.properties"/>
<waitfor maxwait="10" maxwaitunit="second">
<available file="${props.file}"/>
</waitfor>
<property file="${props.file}"/>
答案 1 :(得分:0)
Searchlatestversion.exe是否生成文件C:/Work/latestbuild.properties?
如果是这样,你是否应该在之前暂停/等待加载该属性文件?
你有这个:
<exec .../>
<property file="C:/Work/latestbuild.properties"/>
<sleep seconds="10"/>
如果你没有这个:
<exec ... />
<sleep seconds="10"/>
<property file="C:/Work/latestbuild.properties"/>