ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremy Kie <jeremy...@gmail.com>
Subject Re: is there exitCode in Ant?
Date Tue, 31 Mar 2009 22:05:40 GMT
Take a look at the java Ant task and its 'failonerror' parameter.

-jeremy

On Tue, Mar 31, 2009 at 3:51 PM, David Nemer <davidnemer@gmail.com> wrote:

> Hello Martin,
>
> Thank you. I'm using coding the Ant execution in Java code... so how do I
> call the failonerror of a build process??
>
> Cheers,
> --
> David Nemer
> Sent from Kaiserslautern, RP, Germany
>
> On Tue, Mar 31, 2009 at 11:01 PM, Martin Gainty <mgainty@hotmail.com>
> wrote:
>
> >
> > David
> >
> > http://ant.apache.org/manual/CoreTasks/exec.html
> >
> > failonerror
> >    Stop the buildprocess if the command exits with a
> >      return code signaling failure. Defaults to false.
> >
> > resultproperty would contain the name of a property in which the return
> > code of the
> >      command should be stored. Only of interest if failonerror=false.
> >
> > HTH
> > Martin
> > ______________________________________________
> > Verzicht und Vertraulichkeitanmerkung / Disclaimer and confidentiality
> note
> > Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
> > Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede
> unbefugte
> > Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
> > dient lediglich dem Austausch von Informationen und entfaltet keine
> > rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
> > E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
> > This message is confidential and may be privileged. If you are not the
> > intended recipient, we kindly ask you to  please inform the sender. Any
> > unauthorised dissemination or copying hereof is prohibited. This message
> > serves for information purposes only and shall not have any legally
> binding
> > effect. Given that e-mails can easily be subject to manipulation, we can
> not
> > accept any liability for the content provided.
> >
> >
> >
> >
> >
> >
> > > Date: Tue, 31 Mar 2009 22:37:59 +0200
> > > Subject: Re: is there exitCode in Ant?
> > > From: davidnemer@gmail.com
> > > To: user@ant.apache.org
> > >
> > > 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
> >
> > _________________________________________________________________
> > Quick access to Windows Live and your favorite MSN content with Internet
> > Explorer 8.
> >
> >
> http://ie8.msn.com/microsoft/internet-explorer-8/en-us/ie8.aspx?ocid=B037MSN55C0701A
> >
>

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