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_Jenkins - Fatal编程技术网

Ant 蚂蚁没有运行所有目标

Ant 蚂蚁没有运行所有目标,ant,jenkins,Ant,Jenkins,我有以下ant文件,它没有运行目标“prepForDeployment”和“deployToStaging”。这个任务是由Jenkins运行的,当我查看测试的控制台输出时,没有发现任何构建错误 <?xml version="1.0" encoding="UTF-8"?> <project name="deploy" default="runUnitTests" basedir="."> <description> Deploys

我有以下ant文件,它没有运行目标“prepForDeployment”和“deployToStaging”。这个任务是由Jenkins运行的,当我查看测试的控制台输出时,没有发现任何构建错误

 <?xml version="1.0" encoding="UTF-8"?>
   <project name="deploy" default="runUnitTests" basedir=".">
    <description>
        Deploys to staging.
    </description>

    <target name="init">

        <taskdef name="mxunittask" classname="org.mxunit.ant.MXUnitAntTask" classpathref="project.classpath" />

        <!-- dump the properties -->
        <echoproperties prefix="test" />
    </target>

    <target name="clean" depends="init">
        <mkdir dir="${test.junitoutput}" />
    </target>

    <target name="runUnitTests" depends="init,prepForTests">
        <mkdir dir="${test.output.xml}/unit" />
        <runTestDirectory directoryName="." excludes=""/>
    </target>

    <target name="runAllTests" description="Make output directories and run the MXUnit task" depends="init,clean,runUnitTests">
        <!-- generate pretty reports -->
        <antcall target="junitreport" />
        <fail if="tests.bombed" message="Failing the build due to test failures"/>
    </target>


    <target name="junitreport" depends="init" description="Runs the report without running the tests">
        <junitreport todir="${test.junitoutput}">
            <fileset dir="${test.output.xml}">
                <include name="*.xml" />
            </fileset>
            <report format="frames" todir="${test.junitoutput}" />
        </junitreport>
    </target>

    <target name="prepForTests">
        <!-- just a bunch of replace tasks, runs OK -->
    </target>


    <target name="prepForDeployment" depends="init">

        <replace file="Application.cfc">
            <replacetoken>dbcreate="dropcreate"</replacetoken>
            <replacevalue>dbcreate="update"</replacevalue>
        </replace>

        <replace file="Application.cfc">
            <replacetoken>logSQL = true</replacetoken>
            <replacevalue>logSQL = false</replacevalue>
        </replace>

        <echo message="Prepping for deployment done." />
    </target>

    <target name="deployToStaging" depends="prepForDeployment">

        <sequential>
            <!--copy the files to a temp directory-->
            <copy todir="${staging}_temp" overwrite="true">
                <!-- -->
            </copy>

            <!-- delete applicaiton files on staging -->
            <delete quiet="true" includeemptydirs="true">
                <fileset dir="${staging}" />
            </delete>

            <!-- copy files from temp dir to application dir -->
            <copy todir="${staging}" overwrite="true">
                <fileset dir="${staging}_temp" />
            </copy>

            <!-- remove temp dir -->
            <delete quiet="true" includeemptydirs="true">
                <fileset dir="${staging}_temp" />
            </delete>
        </sequential>

        <echo message="The files have been copied to staging." />
    </target>

    <macrodef name="runTestDirectory">
        <attribute name="directoryName"/>
        <attribute name="excludes" default=""/>
        <sequential>
            <mxunittask server="${test.server}" port="${test.serverport}" defaultrunner="${test.runner}" outputdir="${test.output.xml}/@{directoryName}" verbose="true" failureproperty="tests.bombed" errorproperty="tests.bombed">
                <directory path="${test.dir.location}/@{directoryName}" recurse="true" packageName="${test.cfcpath}.@{directoryName}" componentPath="${test.cfcpath}.@{directoryName}" excludes="@{excludes}" />
            </mxunittask>
        </sequential>
    </macrodef>

</project>

部署到暂存。
dbcreate=“dropcreate”
dbcreate=“更新”
logSQL=true
logSQL=false

如果您没有告诉Jenkins运行
prepForDeployment
deployToStaging
目标,那么它不会运行它们,就像在命令行上运行Ant一样


如果希望运行这些目标,请将它们添加到“Invoke Ant”构建步骤下的目标列表中。

在脚本中调用哪些目标?如果没有,则只执行默认目标(runUnitTests)及其依赖项(init、prepForTests)。我怎样才能让其他的作为RunUnitTet的依赖项运行,但在完成触发后执行呢?好的,我想我明白了。如果我希望prepForDeployment依赖于“runUnitTests”的完成,而“deploytostagin”依赖于“prepForDeployment”的完成,那该怎么办呢?谢谢,这很有效。我还注意到我的默认设置是不正确的,它应该是“runAllTests”,在这种情况下,我创建了一个depens-on“deployToStaging”,它有一个depens-on“prepForDeployment”。