Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-5963

mvn.cmd does not return ERROR_CODE

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.3.9
    • Fix Version/s: 3.5.0-alpha-1, 3.5.0
    • Component/s: None
    • Labels:
      None
    • Environment:
      Windows 10

      Description

      mvn.cmd does not return an ERROR_CODE value to an enclosing script in WIndows. Running this script:
      @ECHO OFF
      CALL mvn clean install
      echo "%ERROR_CODE%"

      Now shows "". Previously it showed "0" for success and "1" for error.

      It appears that there is an @endlocal missing. A possible fix is to add
      @endlocal & set ERROR_CODE=%ERROR_CODE%
      before
      exit /B %ERROR_CODE%

        Issue Links

          Activity

          Hide
          hudson Hudson added a comment -

          SUCCESS: Integrated in Jenkins build maven-3.x #1532 (See https://builds.apache.org/job/maven-3.x/1532/)
          MNG-5963 mvn.cmd does not return ERROR_CODE (michaelo: http://git-wip-us.apache.org/repos/asf/?p=maven.git&a=commit&h=1bc69ff93eb8bde73bf4b9872b78eb6f6be4865d)

          • (edit) apache-maven/src/bin/mvn.cmd
          Show
          hudson Hudson added a comment - SUCCESS: Integrated in Jenkins build maven-3.x #1532 (See https://builds.apache.org/job/maven-3.x/1532/ ) MNG-5963 mvn.cmd does not return ERROR_CODE (michaelo: http://git-wip-us.apache.org/repos/asf/?p=maven.git&a=commit&h=1bc69ff93eb8bde73bf4b9872b78eb6f6be4865d ) (edit) apache-maven/src/bin/mvn.cmd
          Hide
          michael-o Michael Osipov added a comment -
          Show
          michael-o Michael Osipov added a comment - Fixed with 1bc69ff93eb8bde73bf4b9872b78eb6f6be4865d .
          Hide
          stephenc Stephen Connolly added a comment -

          Maven 3.4.0 has been dropped. See this thread for more details.

          This issue will need to be re-scheduled for a Maven release in the (hopefully near) future.

          Show
          stephenc Stephen Connolly added a comment - Maven 3.4.0 has been dropped. See this thread for more details. This issue will need to be re-scheduled for a Maven release in the (hopefully near) future.
          Hide
          hudson Hudson added a comment -

          SUCCESS: Integrated in maven-3.x #1211 (See https://builds.apache.org/job/maven-3.x/1211/)
          MNG-5963 mvn.cmd does not return ERROR_CODE (michaelo: rev 314b174e768ac7223fe4ef61b7256376a09e49d1)

          • apache-maven/src/bin/mvn.cmd
          Show
          hudson Hudson added a comment - SUCCESS: Integrated in maven-3.x #1211 (See https://builds.apache.org/job/maven-3.x/1211/ ) MNG-5963 mvn.cmd does not return ERROR_CODE (michaelo: rev 314b174e768ac7223fe4ef61b7256376a09e49d1) apache-maven/src/bin/mvn.cmd
          Hide
          michael-o Michael Osipov added a comment -
          Show
          michael-o Michael Osipov added a comment - Fixed with 314b174e768ac7223fe4ef61b7256376a09e49d1 .
          Hide
          michael-o Michael Osipov added a comment -

          Great, I will go ahead and commit this change. Thanks for reporting!

          Show
          michael-o Michael Osipov added a comment - Great, I will go ahead and commit this change. Thanks for reporting!
          Hide
          larry.singer Larry Singer added a comment -

          Removing the @setlocal at line 56 works in my environment. The error code is now returned correctly.

          Show
          larry.singer Larry Singer added a comment - Removing the @setlocal at line 56 works in my environment. The error code is now returned correctly.
          Hide
          michael-o Michael Osipov added a comment -

          Can you double-check this in your environment? If all is fine, I will remove that line.

          Show
          michael-o Michael Osipov added a comment - Can you double-check this in your environment? If all is fine, I will remove that line.
          Hide
          larry.singer Larry Singer added a comment -

          Michael, I agree that the @setlocal in line 56 appears to be redundant. If this is removed then the patch I posted should not be required.

          Show
          larry.singer Larry Singer added a comment - Michael, I agree that the @setlocal in line 56 appears to be redundant. If this is removed then the patch I posted should not be required.
          Hide
          michael-o Michael Osipov added a comment -

          Larry, you are right. Isn't the setlocal in line 56 redundant?

          Show
          michael-o Michael Osipov added a comment - Larry, you are right. Isn't the setlocal in line 56 redundant?
          Hide
          larry.singer Larry Singer added a comment -

          By my count the script contains 3 @selocal and 2 @endlocal.

          Show
          larry.singer Larry Singer added a comment - By my count the script contains 3 @selocal and 2 @endlocal.
          Hide
          michael-o Michael Osipov added a comment - - edited

          Did I miss something? There is an @endlocal in the script, see here. Please retry from master.

          Show
          michael-o Michael Osipov added a comment - - edited Did I miss something? There is an @endlocal in the script, see here . Please retry from master.

            People

            • Assignee:
              michael-o Michael Osipov
              Reporter:
              larry.singer Larry Singer
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development