簡體   English   中英

螞蟻文件調用批處理文件時如何使構建失敗

[英]How to fail a build when an ant file calls a batch file which calls an ant file

這就是我想要做的。

我有一個ant文件,它調用一個.batch文件,該文件調用一個ant文件來構建組件。

如果組件構建失敗,我希望主ant文件使構建失敗。

主螞蟻文件

<target name="TestingThree">
  <exec executable="${basedir}\..\..\Component\UnitTests.bat" dir="${basedir}\..\..\Component">
    <arg line='run'/>
  </exec>
</target>

批處理文件

if "%1" == "run" call ant -buildfile build.xml test

建築構件ant文件

<target name="test" depends="compile.test, -injectSigningKeys" description="Run Component tests">

    <junit haltonfailure="yes" printsummary="yes" showoutput="yes">
    <test name="Component.TestSuite" todir="${report}" filtertrace="on" />
    <formatter type="xml" usefile="true" />
    <classpath refid="test.classpath" />

    </junit>
</target>

當前,每當我執行主ant文件時,都會調用.batch文件,而另一個ant文件將被調用,這會使構建失敗。 但是主要的螞蟻構建仍然成功。

.batch文件是否有辦法將失敗/成功返回到主ant文件? 我無法直接從主ant文件中調用第二個ant文件。 我也無法將代碼從第二個ant文件傳輸到主ant文件。

您是否failonerror參數?

默認情況下,將忽略a的返回碼; 當您設置failonerror =“ true”時,任何表示失敗的返回碼(特定於OS)都將導致構建失敗。 執行任務

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM