[ http://jira.codehaus.org/browse/MNG-2132?page=all ] Brett Porter closed MNG-2132: -----------------------------
Assign To: Brett Porter Resolution: Duplicate > mvn.bat should exit 1 when maven fails by default > ------------------------------------------------- > > Key: MNG-2132 > URL: http://jira.codehaus.org/browse/MNG-2132 > Project: Maven 2 > Type: Improvement > Components: Command Line > Versions: 2.0, 2.0.1, 2.0.2 > 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. > Reporter: Dan Fabulich > Assignee: Brett Porter > > > 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. > I had originally filed this as MNG-2127, but it was pointed out there that > there is a workaround available: if you use an undocumented workaround > environment variable, MAVEN_TERMINATE_CMD, mvn.bat will behave as expected. > This environment variable is off by default, because if the environment > variable is on, it can close your dos window when you're finished running > Maven. > Aside from the fact that undocumented environment variables are incredibly > goofy, there's absolutely no reason why this environment variable should be > needed. ant.bat doesn't need it. catalina.bat doesn't need it. This is > only 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 on every > operating system and will not require a special environment variable. > (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.) -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]