You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by David Nemer <da...@gmail.com> on 2009/03/31 22:33:34 UTC

is there exitCode in Ant?

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

Re: is there exitCode in Ant?

Posted by Jeremy Kie <je...@gmail.com>.
There is a Java.setFailonerror(), did you read the javadocs for
org.apache.tools.ant.taskdefs.Java?

-jeremy



On Tue, Mar 31, 2009 at 4:19 PM, David Nemer <da...@gmail.com> wrote:

> I'm importing:
>
> import org.apache.tools.ant.Task;
> import org.apache.tools.ant.taskdefs.*;
>
> And they don't seem to recognize the failonerror
>
>
>
> --
> David Nemer
> Sent from Kaiserslautern, RP, Germany
>
> On Wed, Apr 1, 2009 at 12:05 AM, Jeremy Kie <je...@gmail.com> wrote:
>
> > Take a look at the java Ant task and its 'failonerror' parameter.
> >
> > -jeremy
> >
> > On Tue, Mar 31, 2009 at 3:51 PM, David Nemer <da...@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 <mg...@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
> > > >
> > >
> >
>

Re: is there exitCode in Ant?

Posted by David Nemer <da...@gmail.com>.
I'm importing:

import org.apache.tools.ant.Task;
import org.apache.tools.ant.taskdefs.*;

And they don't seem to recognize the failonerror



--
David Nemer
Sent from Kaiserslautern, RP, Germany

On Wed, Apr 1, 2009 at 12:05 AM, Jeremy Kie <je...@gmail.com> wrote:

> Take a look at the java Ant task and its 'failonerror' parameter.
>
> -jeremy
>
> On Tue, Mar 31, 2009 at 3:51 PM, David Nemer <da...@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 <mg...@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 <da...@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
> > >
> >
>

Re: is there exitCode in Ant?

Posted by Jeremy Kie <je...@gmail.com>.
Take a look at the java Ant task and its 'failonerror' parameter.

-jeremy

On Tue, Mar 31, 2009 at 3:51 PM, David Nemer <da...@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 <mg...@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 <da...@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
> >
>

Re: is there exitCode in Ant?

Posted by David Nemer <da...@gmail.com>.
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 <mg...@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 <da...@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
>

RE: is there exitCode in Ant?

Posted by Martin Gainty <mg...@hotmail.com>.
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 <da...@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

Re: is there exitCode in Ant?

Posted by David Nemer <da...@gmail.com>.
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 <da...@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

Re: is there exitCode in Ant?

Posted by Francis Galiegue <fg...@one2team.com>.
Le Tuesday 31 March 2009 22:33:34 David Nemer, vous avez écrit :
> 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);
>         }
>
>     }
>

Use System.exit().


-- 
Francis Galiegue
fge@one2team.com
Ingénieur système
Mob : +33 (0) 683 877 875
Tel : +33 (0) 178 945 552
One2team
40 avenue Raymond Poincaré
75116 Paris

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org