You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by gn...@apache.org on 2026/08/28 13:26:17 UTC
(maven) branch master updated: Fix #12749: suppress false ERROR in mvnsh for successful commands (#12864)
This is an automated email from the ASF dual-hosted git repository.
gnodet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven.git
The following commit(s) were added to refs/heads/master by this push:
new 06864a3b54 Fix #12749: suppress false ERROR in mvnsh for successful commands (#12864)
06864a3b54 is described below
commit 06864a3b5411c620fc63bc0b0e7581c15eb53ac9
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Fri Aug 28 15:26:06 2026 +0200
Fix #12749: suppress false ERROR in mvnsh for successful commands (#12864)
The mvn, mvnenc, and mvnup commands in mvnsh unconditionally logged
an ERROR when catching ExitException, even when the exit code was 0
(success). This made successful commands like `mvn --version` display
a confusing red "[ERROR] mvn command exited with exit code 0".
Only log the error message when the exit code is non-zero, consistent
with how the shell (!) command already handles exit codes.
Co-authored-by: Claude Opus 4.6 <no...@anthropic.com>
---
.../mvnsh/builtin/BuiltinShellCommandRegistryFactory.java | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvnsh/builtin/BuiltinShellCommandRegistryFactory.java b/impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvnsh/builtin/BuiltinShellCommandRegistryFactory.java
index a221e1b5b1..3d989b60ed 100644
--- a/impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvnsh/builtin/BuiltinShellCommandRegistryFactory.java
+++ b/impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvnsh/builtin/BuiltinShellCommandRegistryFactory.java
@@ -202,7 +202,9 @@ private void mvn(CommandInput input) {
.cwd(shellContext.cwd.get())
.build()));
} catch (InvokerException.ExitException e) {
- shellContext.logger.error("mvn command exited with exit code " + e.getExitCode());
+ if (e.getExitCode() != 0) {
+ shellContext.logger.error("mvn command exited with exit code " + e.getExitCode());
+ }
} catch (Exception e) {
saveException(e);
}
@@ -240,7 +242,9 @@ private void mvnenc(CommandInput input) {
.cwd(shellContext.cwd.get())
.build()));
} catch (InvokerException.ExitException e) {
- shellContext.logger.error("mvnenc command exited with exit code " + e.getExitCode());
+ if (e.getExitCode() != 0) {
+ shellContext.logger.error("mvnenc command exited with exit code " + e.getExitCode());
+ }
} catch (Exception e) {
saveException(e);
}
@@ -258,7 +262,9 @@ private void mvnup(CommandInput input) {
.cwd(shellContext.cwd.get())
.build()));
} catch (InvokerException.ExitException e) {
- shellContext.logger.error("mvnup command exited with exit code " + e.getExitCode());
+ if (e.getExitCode() != 0) {
+ shellContext.logger.error("mvnup command exited with exit code " + e.getExitCode());
+ }
} catch (Exception e) {
saveException(e);
}