views:

215

answers:

3

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?

+3  A: 

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

John McG
A: 

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.

Richard Szalay
+1  A: 

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>

Regards, Gilbert

Rebse