停止ant脚本没有失败的构建 [英] Stop ant script without failing build
本文介绍了停止ant脚本没有失败的构建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的ant脚本我想退出(停止执行编译)没有当条件满足失败。我曾尝试使用:
In my ant script I want to exit (stop executing build) without failing when a condition is met. I have tried to use:
<if>
<equals arg1="${variable1}" arg2="${variable2}" />
<then>
<fail status="0" message="No change, exit" />
</then>
</if>
Ant脚本停止条件,但建立失败。我希望要停止的构建,但没有任何错误。我使用调用Ant,在詹金斯的一步。
Ant script is stopped on condition but build is failed. I want to the build to be stopped but with no errors. I'm using "Invoke Ant" step in Jenkins.
感谢。
推荐答案
我会建议重新考虑你的方法重构你的Ant脚本。如果当某个条件满足构建的执行力,而不是失败的构建如果其他条件满足时与你接近它的问题更容易实现:
I would suggest to refactor your ant script by reconsidering your approach. If you approach your problem with "execution of a build when a certain condition is met" instead of "failing the build if another condition is met" it is easier to implement:
<!-- add on top of your build file -->
<if>
<equals arg1="${variable1}" arg2="${variable2}" />
<then>
<property name="runBuild" value="true"/>
</then>
<else>
<property name="runBuild" value="false"/>
</else>
</if>
<!-- add to the target that shall be executed conditionally -->
<target name="myTarget" if="${runBuild}">
...
<!-- exit message as separate target -->
<target name="exitTarget" unless="${runBuild}">
<echo message="No Change, exit" />
</target>
这篇关于停止ant脚本没有失败的构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文