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

"mvn.cmd" does not indicate failure properly when using "&&"

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.3.1
    • Fix Version/s: 3.5.0-alpha-1, 3.5.0
    • Component/s: Command Line
    • Labels:
      None
    • Environment:
      Windows 8.1 Pro 64-bit

      Description

      I recently upgraded from Maven 3.0.4 to 3.3.1. It seems as if "mvn.cmd" no longer indicates failure properly when using "&&".

      Invoking "mvn foo && echo SUCCESS!" using Maven 3.0.4 on Windows causes the following output (notice no trace of "SUCCESS!" as "mvn" fails):

      c:\Temp>mvn foo && echo SUCCESS!
      [INFO] Scanning for projects...
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD FAILURE
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 0.061s
      [INFO] Finished at: Tue Apr 28 14:08:27 CEST 2015
      [INFO] Final Memory: 10M/491M
      [INFO] ------------------------------------------------------------------------
      [ERROR] The goal you specified requires a project to execute but there is no POM in this directory (c:\Temp). Please verify you invoked Maven from the
      correct directory. -> [Help 1]
      [ERROR]
      [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
      [ERROR] Re-run Maven using the -X switch to enable full debug logging.
      [ERROR]
      [ERROR] For more information about the errors and possible solutions, please read the following articles:
      [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MissingProjectException
      

      Invoking "mvn foo && echo SUCCESS!" using Maven 3.3.1 on Windows causes the following output (notice "SUCCESS!" is echoed even though "mvn" fails):

      c:\Temp>mvn foo && echo SUCCESS!
      [INFO] Scanning for projects...
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD FAILURE
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 0.053 s
      [INFO] Finished at: 2015-04-28T14:09:19+02:00
      [INFO] Final Memory: 13M/491M
      [INFO] ------------------------------------------------------------------------
      [ERROR] The goal you specified requires a project to execute but there is no POM in this directory (c:\Temp). Please verify you invoked Maven from the
      correct directory. -> [Help 1]
      [ERROR]
      [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
      [ERROR] Re-run Maven using the -X switch to enable full debug logging.
      [ERROR]
      [ERROR] For more information about the errors and possible solutions, please read the following articles:
      [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MissingProjectException
      SUCCESS!
      

      It is a little strange that it does not work in Maven 3.3.1 as invoking "mvn foo" actually causes "%ERRORLEVEL%" to be set to "1":

      c:\Temp>mvn foo
      [INFO] Scanning for projects...
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD FAILURE
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 0.052 s
      [INFO] Finished at: 2015-04-28T14:09:41+02:00
      [INFO] Final Memory: 13M/491M
      [INFO] ------------------------------------------------------------------------
      [ERROR] The goal you specified requires a project to execute but there is no POM in this directory (c:\Temp). Please verify you invoked Maven from the
      correct directory. -> [Help 1]
      [ERROR]
      [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
      [ERROR] Re-run Maven using the -X switch to enable full debug logging.
      [ERROR]
      [ERROR] For more information about the errors and possible solutions, please read the following articles:
      [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MissingProjectException
      
      c:\Temp>echo %ERRORLEVEL%
      1
      

        Issue Links

          Activity

          Hide
          agudian Andreas Gudian added a comment -

          funny... if I open up a cmd shell and type: mvn fail && echo SUCCESS, then the echo is not printed. If I type mvn -version && echo SUCCESS, the echo will be executed and SUCCESS is printed.

          Could you perhaps dig a little deeper into the problem to see if you find out more?

          Show
          agudian Andreas Gudian added a comment - funny... if I open up a cmd shell and type: mvn fail && echo SUCCESS , then the echo is not printed. If I type mvn -version && echo SUCCESS , the echo will be executed and SUCCESS is printed. Could you perhaps dig a little deeper into the problem to see if you find out more?
          Hide
          pkg-elsevier Peter Kjær Guldbæk added a comment -

          I downloaded the most recent version (v3.3.3) to see if that made any change, but it still fails. The following is output from reproducing it on "Windows 8.1 Pro" (English) using "cmd.exe":

          Microsoft Windows [Version 6.3.9600]
          (c) 2013 Microsoft Corporation. All rights reserved.
          
          C:\Users\pkg>cd \temp
          
          C:\Temp>SET PATH=C:\pack\apache-maven-3.3.3\bin;c:\Program Files\Java\jdk1.8.0_31\bin
          
          C:\Temp>mvn -version
          Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T13:57:37+02:00)
          Maven home: C:\pack\apache-maven-3.3.3\bin\..
          Java version: 1.8.0_31, vendor: Oracle Corporation
          Java home: C:\Program Files\Java\jdk1.8.0_31\jre
          Default locale: en_GB, platform encoding: Cp1252
          OS name: "windows 8.1", version: "6.3", arch: "amd64", family: "dos"
          
          C:\Temp>java -version
          java version "1.8.0_31"
          Java(TM) SE Runtime Environment (build 1.8.0_31-b13)
          Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)
          
          C:\Temp>mvn fail && echo SUCCESS
          [INFO] Scanning for projects...
          [INFO] ------------------------------------------------------------------------
          [INFO] BUILD FAILURE
          [INFO] ------------------------------------------------------------------------
          [INFO] Total time: 0.051 s
          [INFO] Finished at: 2015-05-05T08:30:17+02:00
          [INFO] Final Memory: 13M/491M
          [INFO] ------------------------------------------------------------------------
          [ERROR] The goal you specified requires a project to execute but there is no POM in this directory (C:\Temp). Please ver
          ify you invoked Maven from the correct directory. -> [Help 1]
          [ERROR]
          [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
          [ERROR] Re-run Maven using the -X switch to enable full debug logging.
          [ERROR]
          [ERROR] For more information about the errors and possible solutions, please read the following articles:
          [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MissingProjectException
          SUCCESS
          
          C:\Temp>dir pom.xml
           Volume in drive C is Boot
           Volume Serial Number is 64A1-1E24
          
           Directory of C:\Temp
          
          File Not Found
          
          C:\Temp>
          

          I start out with setting the path to only include Maven and Java to avoid any of my other installed software getting activated. I invoke the "mvn" command in a directory that does not contain a "pom.xml" to further simplify the scenario.

          As previously noted we have thus far been "stranded" on an old Maven version (v3.0.4), so I may have overlooked something I need to configure for the new version?

          Show
          pkg-elsevier Peter Kjær Guldbæk added a comment - I downloaded the most recent version (v3.3.3) to see if that made any change, but it still fails. The following is output from reproducing it on "Windows 8.1 Pro" (English) using "cmd.exe": Microsoft Windows [Version 6.3.9600] (c) 2013 Microsoft Corporation. All rights reserved. C:\Users\pkg>cd \temp C:\Temp>SET PATH=C:\pack\apache-maven-3.3.3\bin;c:\Program Files\Java\jdk1.8.0_31\bin C:\Temp>mvn -version Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T13:57:37+02:00) Maven home: C:\pack\apache-maven-3.3.3\bin\.. Java version: 1.8.0_31, vendor: Oracle Corporation Java home: C:\Program Files\Java\jdk1.8.0_31\jre Default locale: en_GB, platform encoding: Cp1252 OS name: "windows 8.1", version: "6.3", arch: "amd64", family: "dos" C:\Temp>java -version java version "1.8.0_31" Java(TM) SE Runtime Environment (build 1.8.0_31-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode) C:\Temp>mvn fail && echo SUCCESS [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 0.051 s [INFO] Finished at: 2015-05-05T08:30:17+02:00 [INFO] Final Memory: 13M/491M [INFO] ------------------------------------------------------------------------ [ERROR] The goal you specified requires a project to execute but there is no POM in this directory (C:\Temp). Please ver ify you invoked Maven from the correct directory. -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MissingProjectException SUCCESS C:\Temp>dir pom.xml Volume in drive C is Boot Volume Serial Number is 64A1-1E24 Directory of C:\Temp File Not Found C:\Temp> I start out with setting the path to only include Maven and Java to avoid any of my other installed software getting activated. I invoke the "mvn" command in a directory that does not contain a "pom.xml" to further simplify the scenario. As previously noted we have thus far been "stranded" on an old Maven version (v3.0.4), so I may have overlooked something I need to configure for the new version?
          Hide
          michael-o Michael Osipov added a comment -

          I think this has been fixed with MNG-5963.

          Show
          michael-o Michael Osipov added a comment - I think this has been fixed with MNG-5963 .
          Hide
          pkg-elsevier Peter Kjær Guldbæk added a comment -

          My machine has been upgraded to Windows 10 Pro in the meantime, so that is what I am using for this example.

          I downloaded https://builds.apache.org/job/maven-3.x/1211/artifact/apache-maven/target/apache-maven-3.4.0-SNAPSHOT-bin.zip (followed the link from https://builds.apache.org/job/maven-3.x/1211/ as referenced in MNG-5963) and extracted it to "c:\temp\apache-maven-3.4.0-SNAPSHOT-bin".

          Started "cmd.exe".

          Executed the following:

          Microsoft Windows [Version 10.0.10586]
          (c) 2015 Microsoft Corporation. All rights reserved.
          
          C:\Users\pkg>cd \temp\apache-maven-3.4.0-SNAPSHOT-bin\apache-maven-3.4.0-SNAPSHOT
          
          C:\Temp\apache-maven-3.4.0-SNAPSHOT-bin\apache-maven-3.4.0-SNAPSHOT>set path=
          
          C:\Temp\apache-maven-3.4.0-SNAPSHOT-bin\apache-maven-3.4.0-SNAPSHOT>mvn
          'mvn' is not recognized as an internal or external command,
          operable program or batch file.
          
          C:\Temp\apache-maven-3.4.0-SNAPSHOT-bin\apache-maven-3.4.0-SNAPSHOT>set path=C:\Temp\apache-maven-3.4.0-SNAPSHOT-bin\apache-maven-3.4.0-SNAPSHOT\bin;c:\Program Files\Java\jdk1.8.0_31\bin
          
          C:\Temp\apache-maven-3.4.0-SNAPSHOT-bin\apache-maven-3.4.0-SNAPSHOT>mvn -version
          Apache Maven 3.4.0-SNAPSHOT (314b174e768ac7223fe4ef61b7256376a09e49d1; 2016-02-03T23:17:08+01:00)
          Maven home: C:\Temp\apache-maven-3.4.0-SNAPSHOT-bin\apache-maven-3.4.0-SNAPSHOT\bin\..
          Java version: 1.8.0_31, vendor: Oracle Corporation
          Java home: C:\Program Files\Java\jdk1.8.0_31\jre
          Default locale: en_GB, platform encoding: Cp1252
          OS name: "windows 8.1", version: "6.3", arch: "amd64", family: "dos"
          
          C:\Temp\apache-maven-3.4.0-SNAPSHOT-bin\apache-maven-3.4.0-SNAPSHOT>dir pom.xml
           Volume in drive C is Boot
           Volume Serial Number is 64A1-1E24
          
           Directory of C:\Temp\apache-maven-3.4.0-SNAPSHOT-bin\apache-maven-3.4.0-SNAPSHOT
          
          File Not Found
          
          C:\Temp\apache-maven-3.4.0-SNAPSHOT-bin\apache-maven-3.4.0-SNAPSHOT>mvn fail && echo SUCCESS
          [INFO] Scanning for projects...
          [INFO] ------------------------------------------------------------------------
          [INFO] BUILD FAILURE
          [INFO] ------------------------------------------------------------------------
          [INFO] Total time: 0.051 s
          [INFO] Finished at: 2016-02-16T07:47:42+01:00
          [INFO] Final Memory: 14M/491M
          [INFO] ------------------------------------------------------------------------
          [ERROR] The goal you specified requires a project to execute but there is no POM in this directory (C:\Temp\apache-maven-3.4.0-SNAPSHOT-bin\apache-maven-3.4.0-SNAPSHOT). Please verify you invoked Maven from the correct directory. -> [Help 1]
          [ERROR]
          [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
          [ERROR] Re-run Maven using the -X switch to enable full debug logging.
          [ERROR]
          [ERROR] For more information about the errors and possible solutions, please read the following articles:
          [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MissingProjectException
          SUCCESS
          

          As you can see from the above, the result is still the same. "SUCCESS" should not be output when "mvn" fails.

          I get the feeling that I am doing something wrong, but I have tried to be as thorough as possible in my reproduction of the problem. Can you perform the same set of steps and not observe the issue I am experiencing?

          Show
          pkg-elsevier Peter Kjær Guldbæk added a comment - My machine has been upgraded to Windows 10 Pro in the meantime, so that is what I am using for this example. I downloaded https://builds.apache.org/job/maven-3.x/1211/artifact/apache-maven/target/apache-maven-3.4.0-SNAPSHOT-bin.zip (followed the link from https://builds.apache.org/job/maven-3.x/1211/ as referenced in MNG-5963 ) and extracted it to "c:\temp\apache-maven-3.4.0-SNAPSHOT-bin". Started "cmd.exe". Executed the following: Microsoft Windows [Version 10.0.10586] (c) 2015 Microsoft Corporation. All rights reserved. C:\Users\pkg>cd \temp\apache-maven-3.4.0-SNAPSHOT-bin\apache-maven-3.4.0-SNAPSHOT C:\Temp\apache-maven-3.4.0-SNAPSHOT-bin\apache-maven-3.4.0-SNAPSHOT>set path= C:\Temp\apache-maven-3.4.0-SNAPSHOT-bin\apache-maven-3.4.0-SNAPSHOT>mvn 'mvn' is not recognized as an internal or external command, operable program or batch file. C:\Temp\apache-maven-3.4.0-SNAPSHOT-bin\apache-maven-3.4.0-SNAPSHOT>set path=C:\Temp\apache-maven-3.4.0-SNAPSHOT-bin\apache-maven-3.4.0-SNAPSHOT\bin;c:\Program Files\Java\jdk1.8.0_31\bin C:\Temp\apache-maven-3.4.0-SNAPSHOT-bin\apache-maven-3.4.0-SNAPSHOT>mvn -version Apache Maven 3.4.0-SNAPSHOT (314b174e768ac7223fe4ef61b7256376a09e49d1; 2016-02-03T23:17:08+01:00) Maven home: C:\Temp\apache-maven-3.4.0-SNAPSHOT-bin\apache-maven-3.4.0-SNAPSHOT\bin\.. Java version: 1.8.0_31, vendor: Oracle Corporation Java home: C:\Program Files\Java\jdk1.8.0_31\jre Default locale: en_GB, platform encoding: Cp1252 OS name: "windows 8.1", version: "6.3", arch: "amd64", family: "dos" C:\Temp\apache-maven-3.4.0-SNAPSHOT-bin\apache-maven-3.4.0-SNAPSHOT>dir pom.xml Volume in drive C is Boot Volume Serial Number is 64A1-1E24 Directory of C:\Temp\apache-maven-3.4.0-SNAPSHOT-bin\apache-maven-3.4.0-SNAPSHOT File Not Found C:\Temp\apache-maven-3.4.0-SNAPSHOT-bin\apache-maven-3.4.0-SNAPSHOT>mvn fail && echo SUCCESS [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 0.051 s [INFO] Finished at: 2016-02-16T07:47:42+01:00 [INFO] Final Memory: 14M/491M [INFO] ------------------------------------------------------------------------ [ERROR] The goal you specified requires a project to execute but there is no POM in this directory (C:\Temp\apache-maven-3.4.0-SNAPSHOT-bin\apache-maven-3.4.0-SNAPSHOT). Please verify you invoked Maven from the correct directory. -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MissingProjectException SUCCESS As you can see from the above, the result is still the same. "SUCCESS" should not be output when "mvn" fails. I get the feeling that I am doing something wrong, but I have tried to be as thorough as possible in my reproduction of the problem. Can you perform the same set of steps and not observe the issue I am experiencing?
          Hide
          michael-o Michael Osipov added a comment -

          Tried on Windows 10 Pro and Windows 7 Enterprise. On both I see faulty behavior but if I run a simple script like:

          echo awesome
          exit /B 1
          

          echo success is still executed. I am afraid that this is some special command script behavior.

          Show
          michael-o Michael Osipov added a comment - Tried on Windows 10 Pro and Windows 7 Enterprise. On both I see faulty behavior but if I run a simple script like: echo awesome exit /B 1 echo success is still executed. I am afraid that this is some special command script behavior.
          Hide
          pkg-elsevier Peter Kjær Guldbæk added a comment -

          I have been experiementing with a workaround that may help you.

          "workaround.cmd":

          @echo off
          call mvn %*
          if ERRORLEVEL 1 cmd /C exit /B 1
          

          It seems to solve the issue, but in a less than ideal way:

          Microsoft Windows [Version 10.0.10586]
          (c) 2015 Microsoft Corporation. All rights reserved.
          
          C:\Users\pkg>cd \temp\apache-maven-3.4.0-SNAPSHOT-bin\apache-maven-3.4.0-SNAPSHOT\bin
          
          C:\Temp\apache-maven-3.4.0-SNAPSHOT-bin\apache-maven-3.4.0-SNAPSHOT\bin>SET path=\temp\apache-maven-3.4.0-SNAPSHOT-bin\apache-maven-3.4.0-SNAPSHOT\bin;%PATH%
          
          C:\Temp\apache-maven-3.4.0-SNAPSHOT-bin\apache-maven-3.4.0-SNAPSHOT\bin>workaround fail && echo SUCCESS
          [INFO] Scanning for projects...
          [INFO] ------------------------------------------------------------------------
          [INFO] BUILD FAILURE
          [INFO] ------------------------------------------------------------------------
          [INFO] Total time: 0.050 s
          [INFO] Finished at: 2016-02-16T13:24:53+01:00
          [INFO] Final Memory: 14M/491M
          [INFO] ------------------------------------------------------------------------
          [ERROR] The goal you specified requires a project to execute but there is no POM in this directory (C:\Temp\apache-maven-3.4.0-SNAPSHOT-bin\apache-maven-3.4.0-SNAPSHOT\bin). Please verify you invoked Maven from the correct directory. -> [Help 1]
          [ERROR]
          [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
          [ERROR] Re-run Maven using the -X switch to enable full debug logging.
          [ERROR]
          [ERROR] For more information about the errors and possible solutions, please read the following articles:
          [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MissingProjectException
          
          C:\Temp\apache-maven-3.4.0-SNAPSHOT-bin\apache-maven-3.4.0-SNAPSHOT\bin>workaround help:expressions && echo SUCCESS
          [INFO] Scanning for projects...
          [INFO]
          [INFO] ------------------------------------------------------------------------
          [INFO] Building Maven Stub Project (No POM) 1
          [INFO] ------------------------------------------------------------------------
          [INFO]
          [INFO] --- maven-help-plugin:2.2:expressions (default-cli) @ standalone-pom ---
          [INFO] Maven supports the following Plugin expressions:
          
          ${project}: No description available.
          
          ${settings}: No description available.
          
          ${session}: No description available.
          
          ${plugin}: No description available.
          
          ${rootless}: No description available.
          
          ${project.distributionManagementArtifactRepository}: This is the ArtifactRepository used to deploy artifacts built by this Maven.
          
          ${project.parent}: This is the MavenProject instance for the parent of the current POM.
          
          ${project.attachedArtifacts}: This is a list of attachments to the main artifact produced by building the current POM. Attachments are derived works, based on the main build process, such as an ejb-client jar, project sources jar, etc.
          
          ${project.remoteArtifactRepositories}: This is a list of ArtifactRepository instances used to resolve the Artifacts associated with the current POM. NOTE: This list will contain entries for repositories specified by ancestor POMs, including the default built-in super-POM, which is the parent of all POMs.
          
          ${project.pluginArtifacts}: This is the list of Artifact instances for plugins used in the current build for this project. NOTE: This list may contain plugin Artifacts which are implied by the current POM's packaging and the lifecycle phase being built.
          
          ${reactorProjects}: This is the current list of projects being built by Maven.
          
          ${project.artifact}: This is the Artifact instance created from the essential project attributes: groupId, artifactId, version, and packaging (with a default packaging of 'jar').
          
          ${settings.offline}: Flags the system as offline, to prevent accessing the network to resolve artifacts or execute plugins. NOTE: It's also possible to switch to offline mode on a per-build basis, using the '-o' command-line option.
          
          ${project.pluginArtifactRepositories}: This is a list of ArtifactRepository instances used to resolve the Artifacts associated with plugins used in building the current POM. NOTE: This list will contain entries for repositories specified by ancestor POMs, including the default built-in super-POM, which is the parent of all POMs.
          
          ${project.file}: This is the File instance that refers to the location of the current POM on disk.
          
          ${project.artifacts}: This is a set of Artifact instances resolved from the set of dependencies for the current project. NOTE: This will likely contain much more than the direct dependencies of the current POM, since Maven uses transitive, or chained, dependency resolution.
          
          ${settings.interactiveMode}: If false, flags the system to skip prompting the user for any information, or holding up the build waiting for any input. NOTE: It's also possible to switch to batch (ie. non-interactive) mode using the '-B' command-line option.
          
          ${project.parentArtifact}: This is the Artifact instance for the parent of the current POM.
          
          ${localRepository}: The ArtifactRepository instance referencing the local artifact repository.
          
          
          [INFO] ------------------------------------------------------------------------
          [INFO] BUILD SUCCESS
          [INFO] ------------------------------------------------------------------------
          [INFO] Total time: 0.448 s
          [INFO] Finished at: 2016-02-16T13:33:15+01:00
          [INFO] Final Memory: 10M/491M
          [INFO] ------------------------------------------------------------------------
          SUCCESS
          

          Maybe it is possible to work something like that into "mvn.cmd".

          Show
          pkg-elsevier Peter Kjær Guldbæk added a comment - I have been experiementing with a workaround that may help you. "workaround.cmd": @echo off call mvn %* if ERRORLEVEL 1 cmd /C exit /B 1 It seems to solve the issue, but in a less than ideal way: Microsoft Windows [Version 10.0.10586] (c) 2015 Microsoft Corporation. All rights reserved. C:\Users\pkg>cd \temp\apache-maven-3.4.0-SNAPSHOT-bin\apache-maven-3.4.0-SNAPSHOT\bin C:\Temp\apache-maven-3.4.0-SNAPSHOT-bin\apache-maven-3.4.0-SNAPSHOT\bin>SET path=\temp\apache-maven-3.4.0-SNAPSHOT-bin\apache-maven-3.4.0-SNAPSHOT\bin;%PATH% C:\Temp\apache-maven-3.4.0-SNAPSHOT-bin\apache-maven-3.4.0-SNAPSHOT\bin>workaround fail && echo SUCCESS [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 0.050 s [INFO] Finished at: 2016-02-16T13:24:53+01:00 [INFO] Final Memory: 14M/491M [INFO] ------------------------------------------------------------------------ [ERROR] The goal you specified requires a project to execute but there is no POM in this directory (C:\Temp\apache-maven-3.4.0-SNAPSHOT-bin\apache-maven-3.4.0-SNAPSHOT\bin). Please verify you invoked Maven from the correct directory. -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MissingProjectException C:\Temp\apache-maven-3.4.0-SNAPSHOT-bin\apache-maven-3.4.0-SNAPSHOT\bin>workaround help:expressions && echo SUCCESS [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building Maven Stub Project (No POM) 1 [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-help-plugin:2.2:expressions (default-cli) @ standalone-pom --- [INFO] Maven supports the following Plugin expressions: ${project}: No description available. ${settings}: No description available. ${session}: No description available. ${plugin}: No description available. ${rootless}: No description available. ${project.distributionManagementArtifactRepository}: This is the ArtifactRepository used to deploy artifacts built by this Maven. ${project.parent}: This is the MavenProject instance for the parent of the current POM. ${project.attachedArtifacts}: This is a list of attachments to the main artifact produced by building the current POM. Attachments are derived works, based on the main build process, such as an ejb-client jar, project sources jar, etc. ${project.remoteArtifactRepositories}: This is a list of ArtifactRepository instances used to resolve the Artifacts associated with the current POM. NOTE: This list will contain entries for repositories specified by ancestor POMs, including the default built-in super-POM, which is the parent of all POMs. ${project.pluginArtifacts}: This is the list of Artifact instances for plugins used in the current build for this project. NOTE: This list may contain plugin Artifacts which are implied by the current POM's packaging and the lifecycle phase being built. ${reactorProjects}: This is the current list of projects being built by Maven. ${project.artifact}: This is the Artifact instance created from the essential project attributes: groupId, artifactId, version, and packaging (with a default packaging of 'jar'). ${settings.offline}: Flags the system as offline, to prevent accessing the network to resolve artifacts or execute plugins. NOTE: It's also possible to switch to offline mode on a per-build basis, using the '-o' command-line option. ${project.pluginArtifactRepositories}: This is a list of ArtifactRepository instances used to resolve the Artifacts associated with plugins used in building the current POM. NOTE: This list will contain entries for repositories specified by ancestor POMs, including the default built-in super-POM, which is the parent of all POMs. ${project.file}: This is the File instance that refers to the location of the current POM on disk. ${project.artifacts}: This is a set of Artifact instances resolved from the set of dependencies for the current project. NOTE: This will likely contain much more than the direct dependencies of the current POM, since Maven uses transitive, or chained, dependency resolution. ${settings.interactiveMode}: If false, flags the system to skip prompting the user for any information, or holding up the build waiting for any input. NOTE: It's also possible to switch to batch (ie. non-interactive) mode using the '-B' command-line option. ${project.parentArtifact}: This is the Artifact instance for the parent of the current POM. ${localRepository}: The ArtifactRepository instance referencing the local artifact repository. [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 0.448 s [INFO] Finished at: 2016-02-16T13:33:15+01:00 [INFO] Final Memory: 10M/491M [INFO] ------------------------------------------------------------------------ SUCCESS Maybe it is possible to work something like that into "mvn.cmd".
          Hide
          michael-o Michael Osipov added a comment -

          This is something I was thinking about. I guess this is really related to the command file.

          Show
          michael-o Michael Osipov added a comment - This is something I was thinking about. I guess this is really related to the command file.
          Hide
          pbodnar Petr Bodnar added a comment - - edited

          OK, so the solution to make this work seems to be easy (tested on Windows XP & Windows 7): Simply replace the last line of exit /B %ERROR_CODE% with cmd /C exit /B %ERROR_CODE% inside the mvn.cmd. The question now is why the cmd /C was removed, most probably while implementing MNG-5776 (Andreas Gudian?).

          Additionally, we can remove the redundant line @setlocal in order to get the proper %ERROR_CODE% (solution taken from MNG-5963).

          Show
          pbodnar Petr Bodnar added a comment - - edited OK, so the solution to make this work seems to be easy (tested on Windows XP & Windows 7): Simply replace the last line of exit /B %ERROR_CODE% with cmd /C exit /B %ERROR_CODE% inside the mvn.cmd . The question now is why the cmd /C was removed, most probably while implementing MNG-5776 ( Andreas Gudian ?). Additionally, we can remove the redundant line @setlocal in order to get the proper %ERROR_CODE% (solution taken from MNG-5963 ).
          Hide
          michael-o Michael Osipov added a comment -

          Do you mean lines 42 and 139?

          Show
          michael-o Michael Osipov added a comment - Do you mean lines 42 and 139?
          Hide
          pbodnar Petr Bodnar added a comment -

          Hi,

          a) regarding cmd /C, I simply mean the last line of the script,
          b) regarding %ERROR_CODE%, I mean your commit 314b174e768ac7223fe4ef61b7256376a09e49d1 for MNG-5963

          Show
          pbodnar Petr Bodnar added a comment - Hi, a) regarding cmd /C , I simply mean the last line of the script, b) regarding %ERROR_CODE% , I mean your commit 314b174e768ac7223fe4ef61b7256376a09e49d1 for MNG-5963
          Hide
          michael-o Michael Osipov added a comment -

          a) is clear, I'd restore that.
          b) sorry, still not clear. the setlocal was removed because it was dangling. Do you want to restore that with an endlocal?

          Show
          michael-o Michael Osipov added a comment - a) is clear, I'd restore that. b) sorry, still not clear. the setlocal was removed because it was dangling. Do you want to restore that with an endlocal ?
          Hide
          pbodnar Petr Bodnar added a comment -

          a) perfect, thanks
          b) sorry for the confusion, I'm actually accepting your solution, no additional changes required I wrote it down just to have a clear view of these 2 changes which need to be done to have a working mvn.cmd again before a new release comes out...

          Show
          pbodnar Petr Bodnar added a comment - a) perfect, thanks b) sorry for the confusion, I'm actually accepting your solution, no additional changes required I wrote it down just to have a clear view of these 2 changes which need to be done to have a working mvn.cmd again before a new release comes out...
          Hide
          michael-o Michael Osipov added a comment -
          Show
          michael-o Michael Osipov added a comment - Fixed with 176cc12649bf53671148a7cc71c251c671df2d10 .
          Hide
          hudson Hudson added a comment -

          SUCCESS: Integrated in maven-3.x #1267 (See https://builds.apache.org/job/maven-3.x/1267/)
          MNG-5815 "mvn.cmd" does not indicate failure properly when using "&&" (michaelo: rev 176cc12649bf53671148a7cc71c251c671df2d10)

          • apache-maven/src/bin/mvn.cmd
          Show
          hudson Hudson added a comment - SUCCESS: Integrated in maven-3.x #1267 (See https://builds.apache.org/job/maven-3.x/1267/ ) MNG-5815 "mvn.cmd" does not indicate failure properly when using "&&" (michaelo: rev 176cc12649bf53671148a7cc71c251c671df2d10) apache-maven/src/bin/mvn.cmd
          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
          michael-o Michael Osipov added a comment -
          Show
          michael-o Michael Osipov added a comment - Fixed with fe586467ecbd63791001e7a6ddf8f18d4fac19b8 .
          Hide
          hudson Hudson added a comment -

          SUCCESS: Integrated in Jenkins build maven-3.x #1526 (See https://builds.apache.org/job/maven-3.x/1526/)
          MNG-5815 "mvn.cmd" does not indicate failure properly when using "&&" (michaelo: http://git-wip-us.apache.org/repos/asf/?p=maven.git&a=commit&h=fe586467ecbd63791001e7a6ddf8f18d4fac19b8)

          • (edit) apache-maven/src/bin/mvn.cmd
          Show
          hudson Hudson added a comment - SUCCESS: Integrated in Jenkins build maven-3.x #1526 (See https://builds.apache.org/job/maven-3.x/1526/ ) MNG-5815 "mvn.cmd" does not indicate failure properly when using "&&" (michaelo: http://git-wip-us.apache.org/repos/asf/?p=maven.git&a=commit&h=fe586467ecbd63791001e7a6ddf8f18d4fac19b8 ) (edit) apache-maven/src/bin/mvn.cmd

            People

            • Assignee:
              michael-o Michael Osipov
              Reporter:
              pkg-elsevier Peter Kjær Guldbæk
            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development