You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by kamilofski <ka...@gmail.com> on 2011/02/02 23:45:05 UTC

getting maven failure code in ant

I am currently invoking mvn from ant.  However, when there is a BUILD FAILURE
inside mvn, the ant script is still showing that the build is successful. 

How could I determine what the error code is from mvn and read it into ant? 
Any ideas?
-- 
View this message in context: http://maven.40175.n5.nabble.com/getting-maven-failure-code-in-ant-tp3368588p3368588.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: getting maven failure code in ant

Posted by Lucas Persson <lu...@oracle.com>.
Hi

when maven fails it returns with an exit code != 0 as most other tools 
commands
Check for that in Ant.

Cheers
Lucas

On 02/03/2011 05:30 AM, kamilofski wrote:
> Thanks for the quick response.
>
> I am actually already running maven from within ANT, except I am not sure
> how to signal ant to say 'build failure' when the maven build fails.
> Currently it is saying 'build successful' in ANT but 'build failure' in
> maven.

-- 
Oracle <http://www.oracle.com>
Lucas Persson | Principal Member of Technical Staff
Phone: +4684773644 <tel:+4684773644> | | | Mobile: +46730946656 
<tel:+46730946656>
Oracle Communications Platform
ORACLE Sweden | Folkungagatan 122 | 116 30 Stockholm

Oracle Svenska AB, Kronborgsgränd 17, S-164 28 KISTA, reg.no. 556254-6746
Green Oracle <http://www.oracle.com/commitment> Oracle is committed to 
developing practices and products that help protect the environment

RE: getting maven failure code in ant

Posted by kamilofski <ka...@gmail.com>.
Thanks for the quick response.

I am actually already running maven from within ANT, except I am not sure
how to signal ant to say 'build failure' when the maven build fails. 
Currently it is saying 'build successful' in ANT but 'build failure' in
maven.
-- 
View this message in context: http://maven.40175.n5.nabble.com/getting-maven-failure-code-in-ant-tp3368588p3368812.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: getting maven failure code in ant

Posted by Martin Gainty <mg...@hotmail.com>.
you can run mvn in ant as a java task

suggested attributes::
spawn=false
fork=false
output=SomeOutputFIle
error=SomeErrorFile
be sure all the necessary maven jars are on classpath before invoking

BTW: this is  the command line you want to emulate in your Java task..you'll need to supply all the env variables

%MAVEN_JAVA_EXE% %MAVEN_OPTS% -classpath %CLASSWORLDS_JAR% "-Dclassworlds.conf=%M2_HOME%\bin\m2.conf" "-Dmaven.home=%M2_HOME%" %CLASSWORLDS_LAUNCHER% %MAVEN_CMD_LINE_ARGS%

i assume you're using the same JVM for ANT and maven?
 
http://www.jajakarta.org/ant/ant-1.6.1/docs/en/manual/CoreTasks/java.html
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 
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.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.




> Date: Wed, 2 Feb 2011 14:45:05 -0800
> From: kamilski81@gmail.com
> To: users@maven.apache.org
> Subject: getting maven failure code in ant
> 
> 
> I am currently invoking mvn from ant.  However, when there is a BUILD FAILURE
> inside mvn, the ant script is still showing that the build is successful. 
> 
> How could I determine what the error code is from mvn and read it into ant? 
> Any ideas?
> -- 
> View this message in context: http://maven.40175.n5.nabble.com/getting-maven-failure-code-in-ant-tp3368588p3368588.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>