Ant equivalent of nant.onsuccess / nant.onfailure

孤街醉人 提交于 2019-12-11 06:28:41

问题


NAnt has two built-in properties, nant.onsuccess and nant.onfailure, for specifying tasks to run on success and failure respectively.

Is there an equivalent in Ant?


回答1:


I don't think there's an ant equivalent but you could use trycatch (part of ant-contrib)

<trycatch>
  <try>
    <!-- Your code here -->
    <!-- Success message -->
  </try>
  <catch>
    <!-- Fail message -->
  </catch>
</trycatch> 

Hope this helps




回答2:


Kev Jackson, gave a neat example of an exec-listener in his presentation, = http://people.apache.org/~kevj/ossummit/extending-ant.html, the sources of the exec-listener are included

You're able to kick off specific tasks depending on the build result after your build has finished.

<exec-listener onSuccess="true|false">
 ..

your stuff goes here
..
</exec-listener>



回答3:


Although I've marked John McG as the answer (as it's what I've gone with), I've also discovered that it's also possible to build similar functionality using BuildListeners.



来源:https://stackoverflow.com/questions/1254032/ant-equivalent-of-nant-onsuccess-nant-onfailure

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!