退出ant目标而不会失败构建

时间:2016-01-29 13:24:52

标签: ant exit

我正在寻找退出目标的方法并继续运行ant代码而不退出整个过程。像下面的东西,但我得到错误。

<target name="foo">
<some-task/>
<another-task/>

<condition property="should.exit">
(condition check here....)
</condition>

<exit if="should.exit" message="some message"/>

(skipped tasks if "should.exit" is true)

</target>

我得到的错误:

Problem: failed to create task or type exit   
[sshexec]      [echo] Cause: The name is undefined.   
[sshexec]    
[sshexec]      [echo] Action: Check the spelling.   
[sshexec]    
[sshexec]      [echo] Action: Check that any custom tasks/types have been declared.   
[sshexec]      [echo] Action: Check that any <presetdef>/<macrodef> declarations have taken place.   
[sshexec]    
[sshexec]      [echo]    [sshexec]    
[sshexec]      [echo]                    ERROR Error error

1 个答案:

答案 0 :(得分:0)

<target name="foo">
<some-task/>
<another-task/>

<condition property="should.exit">
(condition check here....)
</condition>

<fail message="failing">
    <condition>
        <equals arg1="${should.exit}" arg2="true"/>
    </condition>
</fail>

(skipped tasks if "should.exit" is true)

</target>