Hi,
I need to call mvn from ant and I tried to do that as follows:
<exec executable="mvn.bat" failonerror="true">
<arg line="install"/>
</exec>
The problem is that the "failonerror" is not working when mvn fails. I'm working under Windows XP.
After some investigations, I came to the conclusion that the errorlevel is not correctly propagated back to ant when it execs the mvn.bat script.
To cope with that issue, I currently use a workaround, but it implies to modify the "mvn.bat" script in order to:
- trap errors slightly differently,
- remove the /B from the final exit command.
Then, I renamed the modified "mvn.bat" file to "mvn-batch.bat" and create a new "mvn.bat" file to do the following:
@echo off
cmd /c "mvn-batch.bat %*"
Eventually, I use the "mvn-batch.bat" file in my "exec" task:
<exec executable="mvn-batch.bat" failonerror="true"/>
This way, the failonerror is working ok and ant failed as expected when mvn fails!
To say the less, I'm a bit disappointed by the complexity of this solution! Thus I would be pleased to get any feedback on this, especially if someone could provide a better solution.
Any comments are welcome...
Rgds,
-Xavier
Ce message et ses pièces jointes (le "message") est destiné à l'usage exclusif de son destinataire. Si vous recevez ce message par erreur, merci d'en aviser immédiatement l'expéditeur et de le détruire ensuite. Le présent message pouvant être altéré à notre insu, CALYON Corporate and Investment Bank ne peut pas être engagé par son contenu. Tous droits réservés.
This message and/or any attachments (the "message") is intended for the sole use of its addressee. If you are not the addressee, please immediately notify the sender and then destroy the message. As this message and/or any attachments may have been altered without our knowledge, its content is not legally binding on CALYON Corporate and Investment Bank. All rights reserved.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
