Муравей не запускает все цели - PullRequest
1 голос
/ 21 февраля 2012

У меня есть следующий файл 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>

1 Ответ

2 голосов
/ 21 февраля 2012

Если вы не говорите Дженкинсу запускать цели prepForDeployment и deployToStaging, тогда они не будут запускаться, точно так же, как при запуске Ant в командной строке.

Если вычтобы эти цели выполнялись, добавьте их в список целей на этапе сборки «Invoke Ant».

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...