diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java index e1c61ef9d9..6c4ba5850c 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java @@ -28,6 +28,7 @@ import java.util.StringTokenizer; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.ParseException; +import org.apache.commons.cli.UnrecognizedOptionException; import org.apache.maven.Maven; import org.apache.maven.exception.DefaultExceptionHandler; import org.apache.maven.exception.ExceptionHandler; @@ -163,7 +164,12 @@ public class MavenCli { return e.exitCode; } - catch( Exception e ) + catch ( UnrecognizedOptionException e ) + { + // pure user error, suppress stack trace + return 1; + } + catch ( Exception e ) { CLIReportingUtils.showError( logger, "Error executing Maven.", e, cliRequest.showErrors );