[
https://issues.apache.org/jira/browse/MNG-5815?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15148533#comment-15148533
]
Peter Kjær Guldbæk commented on MNG-5815:
-----------------------------------------
I have been experiementing with a workaround that may help you.
"workaround.cmd":
{noformat}
@echo off
call mvn %*
if ERRORLEVEL 1 cmd /C exit /B 1
{noformat}
It seems to solve the issue, but in a less than ideal way:
{noformat}
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
{noformat}
Maybe it is possible to work something like that into "mvn.cmd".
> "mvn.cmd" does not indicate failure properly when using "&&"
> ------------------------------------------------------------
>
> Key: MNG-5815
> URL: https://issues.apache.org/jira/browse/MNG-5815
> Project: Maven
> Issue Type: Bug
> Components: Command Line
> Affects Versions: 3.3.1
> Environment: Windows 8.1 Pro 64-bit
> Reporter: Peter Kjær Guldbæk
>
> 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):
> {noformat}
> 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
> {noformat}
> Invoking "mvn foo && echo SUCCESS!" using Maven 3.3.1 on Windows causes the
> following output (notice "SUCCESS!" is echoed even though "mvn" fails):
> {noformat}
> 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!
> {noformat}
> 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":
> {noformat}
> 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
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)