2014-04-13 2 views
1

다음은 내가하려고하는 작업입니다.개미 파일이 개미 파일을 호출하는 배치 파일을 호출 할 때 빌드를 실패하는 방법

나는 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 

건물의 구성 요소 개미 파일

<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> 

의 CUr rently 내가 main ant 파일을 실행할 때마다 .batch 파일이 호출되고 다른 ant 파일이 호출되어 빌드에 실패합니다. 하지만 여전히 주요 개미 빌드가 성공합니다.

.batch 파일이 주 ant 파일에 실패/성공을 반환하는 방법이 있습니까? 주 ant 파일에서 두 번째 ant 파일을 직접 호출 할 수 없습니다. 둘째 앤트 파일의 코드를 주 앤트 파일로 전송할 수도 없다.

답변

2

failonerror 매개 변수를 살펴 보셨습니까?

기본적으로 a의 반환 코드는 무시됩니다. failonerror = "true"로 설정하면 리턴 코드 신호 실패 (OS 특정)로 인해 빌드가 실패합니다. Exec task

관련 문제