在我的 ant 脚本中,我想在满足条件时退出(停止执行构建)而不会失败。我尝试过使用:
<if>
<equals arg1="${variable1}" arg2="${variable2}" />
<then>
<fail status="0" message="No change, exit" />
</then>
</if>
Ant 脚本根据条件停止,但构建失败。我希望构建停止但没有错误。我在 Jenkins 中使用“调用 Ant”步骤。
Thanks.
我建议通过重新考虑你的方法来重构你的蚂蚁脚本。如果您用“满足特定条件时执行构建”来解决问题,而不是“如果满足另一个条件则构建失败”,则更容易实现:
<!-- 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>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)