2012-02-21 14 views
1

target "prepForDeployment"と "deployToStaging"を実行していない以下のantファイルがあります。このタスクはJenkinsによって実行されており、テストのコンソール出力を見るとビルドエラーは発生しません。Antがすべてのターゲットを実行していません

<?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}[email protected]{directoryName}" componentPath="${test.cfcpath}[email protected]{directoryName}" excludes="@{excludes}" /> 
      </mxunittask> 
     </sequential> 
    </macrodef> 

</project> 
+1

スクリプトでどのターゲットを呼び出していますか?存在しない場合は、default-target(runUnitTests)とその依存関係(init、prepForTests)のみが実行されます。 – Mnementh

+0

私はrunUnitTestsフォームもJenkinsを呼び出しています。他のユーザーにrunUnitTetsの依存関係として実行させるにはどうしたらいいですか?のトリガーなしで完了した後に実行するにはどうすればよいですか? – bittersweetryan

答えて

2

あなたはコマンドラインでのAntを実行する場合のようにちょうど同じ、それはそれらを実行しませんprepForDeploymentdeployToStaging目標を実行するために、ジェンキンスを言っていない場合。

これらのターゲットを実行する場合は、「Invoke Ant」ビルドステップのターゲットリストにターゲットを追加します。

+0

OK、私はそれを得ていると思います。 prepForDeploymentを "runUnitTests"に依存させ、 "prepForDeployment"に依存して "deployToStaging"を完了させたい場合はどうすればよいですか? – bittersweetryan

+0

ありがとう、これは働いた。私はまた私のデフォルトが間違っていたことに気付きました。 "runAllTests"だったはずです。作成した場合、 "prepForDeployment"に依存する "deployToStaging"に依存します。 – bittersweetryan

関連する問題