ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Nemer <davidne...@gmail.com>
Subject Re: is there exitCode in Ant?
Date Tue, 31 Mar 2009 20:37:59 GMT
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 <davidnemer@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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message