You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by R Smith <on...@hotmail.com> on 2004/10/20 02:07:56 UTC

Performing a task besides e-mail upon failure

Hi.  I am trying to find out if you can use Ant to perform some alternative 
task besides e-mail if some of your main tasks fail.  More specifically, I 
am trying to do the following:

I am running an automated build process.  First, I increment a build number. 
  Then I pull code from Subversion and build.  Next, I run some unit tests, 
and after that I run FxCop.  If any of these tasks fail, I want to do more 
than simply send out an e-mail message.  That is, upon some failure, I want 
to use "svnlook" in Subversion to find out what developers have checked in 
since the last successful build and then send out e-mail with this 
information.

In Ant, is there a way to invoke some task at the end like "svnlook" if 
something has failed?  Or do I need to use something additional to 
accomplish this, like batch files?

Thanks for any info on this.

-rs

_________________________________________________________________
Don’t just search. Find. Check out the new MSN Search! 
http://search.msn.click-url.com/go/onm00200636ave/direct/01/


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: Performing a task besides e-mail upon failure

Posted by Tom Ball <To...@Sun.COM>.
On Wed, 20 Oct 2004, R. Smith <on...@hotmail.com> wrote:
> > Hi.  I am trying to find out if you can use Ant to perform some
> > alternative task besides e-mail if some of your main tasks fail.

Instead of using Ant as a golden hammer for all build problems, consider
instead using an Ant-friendly free tool that focuses on build
automation, such as CruiseControl
(http://cruisecontrol.sourceforge.net/).  I first read about it in the
excellent book, Pragmatic Project Automation:

  http://www.pragmaticprogrammer.com/starter_kit/au/index.html

This book describes lots of alternative build monitor options, from
automatic paging, RSS feeds with IDE dashboard plug-ins, even
build-controlled red and green lava lamps for the break room.

Tom


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: Performing a task besides e-mail upon failure

Posted by Stefan Bodewig <bo...@apache.org>.
On Wed, 20 Oct 2004, R. Smith <on...@hotmail.com> wrote:

> Hi.  I am trying to find out if you can use Ant to perform some
> alternative task besides e-mail if some of your main tasks fail.

Use a BuildListener - this will receive all events necessary to decide
what to do and can do whatever you want.  This is the pure Ant option.

> In Ant, is there a way to invoke some task at the end like "svnlook"
> if something has failed?

AntContrib <http://ant-contrib.sf.net/> offers an alternative in the
form of a trycatch task.  You could catch the exception and use normal
Ant task inside the catch block.  This is the less pure version.

Since you'll have to code your actions yourself anyway - like running
svnlook and parsing the result - a BuildListener seems to be the
cleaner approach to me.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org