maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve Loughran (JIRA)" <>
Subject [jira] Commented: (MNG-2127) mvn.bat always exits 0 on Windows 2000 and higher
Date Thu, 09 Mar 2006 09:42:23 GMT
    [ ] 

Steve Loughran commented on MNG-2127:

Dan, the last fix was bugzilla ID 32069

and the SVN HEAD of ant.bat contains it, just after the :end statement

As far as ant is concerned, winnt==anything running on the winnt kernel, from version 3.1
up. specifically,. anything whose %OS% env variable is set to winnt or Windows_NT ,the latter
being what XP systems do.

The way the ant script sets the error code is to abuse the color command to try and set the
fg and bg colours to match. From the documentation
"The COLOR command sets ERRORLEVEL to 1 if an attempt is made to execute
the COLOR command with a foreground and background color that are the

so COLOR 00 sets ERROLEVEL to 1, which is what you want

> mvn.bat always exits 0 on Windows 2000 and higher
> -------------------------------------------------
>          Key: MNG-2127
>          URL:
>      Project: Maven 2
>         Type: Bug

>   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
>     Priority: Blocker
>  Attachments: mvnfixed.bat, mvnfixed.bat
> 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"

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:

View raw message