Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Blocker
-
Resolution: Won't Fix
-
Affects Version/s: 2.0, 2.0.1, 2.0.2
-
Fix Version/s: None
-
Component/s: Command Line
-
Labels:None
-
Environment:I'm on Windows 2003 Server, but this will affect any OS for which the %OS% environment variable is Windows_NT, including Windows XP and Windows 2000.
-
Complexity:Intermediate
-
Testcase included:yes
-
Number of attachments :
Description
Write the following ant script and run it on Windows 2000 or higher: <project default="main"><target name="main"><exec executable="mvn.bat" failonerror="true" /></target></project>
This will run "mvn" with no arguments, which will always fail. But the ant script will claim "build successful", because the exit value of mvn.bat was 0. It is absolutely critical that this work correctly, or else I can't integrate Maven into any other automated system.
This is happening because mvn.bat is improperly abusing local scoping. On line 130 of mvn.bat, we execute maven, but we don't do anything with its exit value... we just always goto end. The fix for this is to add a line 131 that says "if errorlevel 1 goto error", which will behave correctly.
(I marked this as having a test case because I've included a test ant script, but technically this isn't a JUnit test case, so it may be an inappropriate use of the "testcase included" marker.)
Attachments
Issue Links
| This issue is duplicated by: | ||||
| MNG-2132 | mvn.bat should exit 1 when maven fails by default |
|
|
|
You must set MAVEN_TERMINATE_CMD env var to 'on' :
<project default="main">
<target name="main">
<exec executable="mvn.bat" failonerror="true">
<env key="MAVEN_TERMINATE_CMD" value="on" />
</exec>
</target>
</project>