ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gglazer <>
Subject Ant exit code is zero when an exception is thrown
Date Mon, 01 Jun 2009 19:19:00 GMT

We have a task which extends .  It is capable of
throwing runtime exceptions, so execute() has a try clause with a catch that
looks like this:

catch (Exception e)
            BuildException be = new BuildException(e); //these first three
are for debugging only
            System.out.println("e class: "+e.getClass().getName());  
            System.out.println("be class: "+be.getClass().getName());
            throw new BuildException(e);

wherein we get output that looks like:

e class: java.lang.RuntimeException
be class:

So I know the exception is being thrown, caught and re-thrown as a
BuildException.  The problem is that 

   #echo $? 

returns 0.  Since we are running this in automated mode via TeamCity, this
causes TC to report successful builds even when the log is full of stack

We've tried setting a recorder to store the error messages and
loadfile/condition to check it, but the exception terminates ant's
processing before the recorder stops and the conditions have a chance to
check the file for the exceptions.

Solutions to automated handling of builds terminating in exceptions greatly



View this message in context:
Sent from the Ant - Users mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message