This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
I have an ant project where there is a set of targets. After successful completion of all targets I call mail target at the end to send a mail with attached logs with message build successful.
Now, my challenge is if one of the target fails then build exits so it will not proceed to mail target which is the last one to perform on completion of all. How can I use mail target to send mail on any target failure?
2) Write a CustomExitCode class and invoke the mail target from within it.
Of course, you could always create a script that does:
ant xxx yyy
ant mail
That way the mail target would always run. You'd probably have to tweak the mail target since it would be mailing the result from the prior ant run.
Another thought: having a "finally" target that runs before exit whether the build passed or failed is a good idea. If you created a patch to do that you could submit it back to the community.