If Ant doesn't throw a BuildException, it's successful. There is a type of Exception in Ant's class hierarchy that includes a specific exit code as well.
-Matt --- On Tue, 3/31/09, David Nemer <davidne...@gmail.com> wrote: > From: David Nemer <davidne...@gmail.com> > Subject: Re: is there exitCode in Ant? > To: "Ant Users List" <user@ant.apache.org> > Date: Tuesday, March 31, 2009, 3:37 PM > Ant tells you whether you were able > to build or not with the messages: > > 'BUILD FAILED' or 'BUILD SUCCESSFUL' > > It would be enough for me to just get those answers... > because I'm supposed > to make a statistics on how many revisions can be build and > how many cant... > > Which command from ant returns: 'BUILD FAILED' or 'BUILD > SUCCESSFUL' > > Cheers > > -- > David Nemer > Sent from Kaiserslautern, RP, Germany > > On Tue, Mar 31, 2009 at 10:33 PM, David Nemer <davidne...@gmail.com> > wrote: > > > Hey guys, > > > > I got the integration with Ant and Java working fine. > > > > I was wondering if Ant has something like > getExitCode() that tells you if > > it was successful in building whatever the build.xml > was supposed to, just > > like in Maven. > > > > How would I add it to my code? > > > > private static void > antCaller(){ > > > > File buildFile = > new File("C:\\test\\build.xml"); > > Project p = new > Project(); > > > p.setUserProperty("ant.file", > buildFile.getAbsolutePath()); > > DefaultLogger > consoleLogger = new DefaultLogger(); > > > consoleLogger.setErrorPrintStream(System.err); > > > consoleLogger.setOutputPrintStream(System.out); > > > consoleLogger.setMessageOutputLevel(Project.MSG_INFO); > > > p.addBuildListener(consoleLogger); > > > > try { > > > p.fireBuildStarted(); > > > p.init(); > > > ProjectHelper helper = > ProjectHelper.getProjectHelper(); > > > p.addReference("ant.projectHelper", > helper); > > > helper.parse(p, buildFile); > > > p.executeTarget(p.getDefaultTarget()); > > > p.fireBuildFinished(null); > > } catch > (BuildException e) { > > > p.fireBuildFinished(e); > > } > > > > } > > > > Thank you once again, > > > > Cheers > > > > -- > > David Nemer > > Sent from Kaiserslautern, RP, Germany > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@ant.apache.org For additional commands, e-mail: user-h...@ant.apache.org