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
f...@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-unsubscr...@ant.apache.org
For additional commands, e-mail: user-h...@ant.apache.org

Reply via email to