I have some unit tests running through Ant, and I\'d like to be able to run some cleanup code if the unit tests fail. I was looking for some sort of \"finally\" block, but I
Two possiblities
-1-
use some try/catch/finally construct for specific parts of your script
you need some Ant Plugin that provides those features, f.e. =
Flaka
Antcontrib / Antelope
do your cleanup here
and afterwards don't forget to fail
optionally you may use a finally section also
..
-2-
use a buildlistener for the whole script ( BUILD SUCCESSFUL, BUILD FAILED )
Kev Jackson has a nice 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 in the slides)
You're able to kick off specific tasks depending on the build result after your build has finished
..
your stuff goes here
..