Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
ant脚本属性的问题_Ant - Fatal编程技术网

ant脚本属性的问题

ant脚本属性的问题,ant,Ant,以下是我的ant脚本: <project name="nightly_build" default="main" basedir="C:\Work\6.70_Extensions\NightlyBuild"> <target name="init"> <sequential> <exec executable="C:/Work/Searchlatestversion.exe">

以下是我的ant脚本:

<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}
    并希望允许checksnapshot.exe访问
    latestbuild.properties
    并获得
    ${Product_Version}
  • checksnapshot.exe
    随后将生成
    checksnapshot.properties
    ,然后目标将在main
    antc.bat

  • 我在这里做错什么了吗?似乎
    ${Product\u Version}
    没有被
    checksnapshot.exe

    很好地接收到,您似乎有一个10秒的硬编码等待期,等待
    Searchlatestversion
    写出您的文件。如果可执行文件未在该时间内完成,则无法从文件中读取
    ${Product\u Version}

    你考虑过使用Ant任务吗?顾名思义,这将等待某个条件,然后才能允许任务的其余部分继续进行。你可以这样做

    <property name="props.file" value="C:/Work/latestbuild.properties"/>
    <waitfor maxwait="10" maxwaitunit="second">
      <available file="${props.file}"/>
    </waitfor>
    <property file="${props.file}"/>
    

    您似乎有10秒的硬编码等待时间,等待
    Searchlatestversion
    写出您的文件。如果可执行文件未在该时间内完成,则无法从文件中读取
    ${Product\u Version}

    你考虑过使用Ant任务吗?顾名思义,这将等待某个条件,然后才能允许任务的其余部分继续进行。你可以这样做

    <property name="props.file" value="C:/Work/latestbuild.properties"/>
    <waitfor maxwait="10" maxwaitunit="second">
      <available file="${props.file}"/>
    </waitfor>
    <property file="${props.file}"/>
    

    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"/>
    
    
    
    如果您没有:

            <exec .../>
            <property file="C:/Work/latestbuild.properties"/>
            <sleep seconds="10"/>
    
            <exec ... />
            <sleep seconds="10"/>
            <property file="C:/Work/latestbuild.properties"/>
    

    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"/>
    
    
    
    如果您没有:

            <exec .../>
            <property file="C:/Work/latestbuild.properties"/>
            <sleep seconds="10"/>
    
            <exec ... />
            <sleep seconds="10"/>
            <property file="C:/Work/latestbuild.properties"/>