We have a task which extends org.apache.tools.ant.Task . 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: org.apache.tools.ant.BuildException 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 traces. 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 appreciated. Thanks, Glenn -- View this message in context: http://www.nabble.com/Ant-exit-code-is-zero-when-an-exception-is-thrown-tp23820247p23820247.html Sent from the Ant - Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@ant.apache.org For additional commands, e-mail: user-h...@ant.apache.org