我有执行序列2个步骤的Ant目标:当Ant遇到错误时可以继续吗?
<target name="release">
<antcall target="-compile"/>
<antcall target="-post-compile"/>
</target>
利用上述脚本,如果“-compile”目标失败,立即退出。 “-post-compile”没有机会运行。有没有办法确保即使第一步(-compile)失败,第二步(-post-compile)也会执行?
我有执行序列2个步骤的Ant目标:当Ant遇到错误时可以继续吗?
<target name="release">
<antcall target="-compile"/>
<antcall target="-post-compile"/>
</target>
利用上述脚本,如果“-compile”目标失败,立即退出。 “-post-compile”没有机会运行。有没有办法确保即使第一步(-compile)失败,第二步(-post-compile)也会执行?
我认为你正在寻找
-keep持续(-k)
这将告诉Ant来继续构建不依赖于失败目标的所有目标。
如果您使用的蚂蚁的contrib(这是很常见的),你可以利用的try-catch task,把你的电话post-compile
到其finally
元素。
另外,如果您使用蚂蚁的contrib是不,那么你可能会使用subant任务叫你compile
目标。 subant
有一个failonerror
属性,您可以使用它来单独忽略失败的目标。 task description page上有很多使用示例。