4
명령 줄에서 ant에 매개 변수로 파일 경로를 보내고 있습니다. 매개 변수가 존재하지 않으면 빌드가 실패하기를 원합니다. 그렇게하는 방법은 무엇입니까?Fail 명령 줄 매개 변수가없는 경우 Ant 빌드
감사합니다.
명령 줄에서 ant에 매개 변수로 파일 경로를 보내고 있습니다. 매개 변수가 존재하지 않으면 빌드가 실패하기를 원합니다. 그렇게하는 방법은 무엇입니까?Fail 명령 줄 매개 변수가없는 경우 Ant 빌드
감사합니다.
예를 들어 대상에 if 속성을 사용합니다. :
<project name="test" default="init">
<target name="init" if="${path}">
<!--This will only execute if ${path} is defined from the command line-->
</target>
</project>
두 번째 옵션 : 더 자세한
<project name="test" default="init">
<target name="init">
<fail message="Path is not set! Exiting ant script!">
<condition>
<not>
<isset property="${path}"/>
</not>
</condition>
</fail>
</target>
</project>