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 2025/09/29 14:48:46 UTC
(maven) branch master updated: fix help default text (#11099) (#11175)
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 6d88a84fc3 fix help default text (#11099) (#11175)
6d88a84fc3 is described below
commit 6d88a84fc37f57b2bc955f7af5639cf554201213
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Mon Sep 29 16:48:39 2025 +0200
fix help default text (#11099) (#11175)
Include --infer alongside --model and --plugins in help footer.
Align CLI help with runtime defaults.
(cherry picked from commit 3a3b9352eb9c8a774952a25c4830b06275e2e4c8)
Co-authored-by: Arturo Bernal <ab...@apache.org>
---
.../invoker/mvnup/CommonsCliUpgradeOptions.java | 2 +-
.../cling/invoker/mvnup/PluginUpgradeCliTest.java | 26 ++++++++++++++++++++++
2 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvnup/CommonsCliUpgradeOptions.java b/impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvnup/CommonsCliUpgradeOptions.java
index 3e51b0e088..29025cce9a 100644
--- a/impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvnup/CommonsCliUpgradeOptions.java
+++ b/impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/mvnup/CommonsCliUpgradeOptions.java
@@ -126,7 +126,7 @@ public void displayHelp(ParserRequest request, Consumer<String> printStream) {
printStream.accept(
" -a, --all Apply all upgrades (equivalent to --model-version 4.1.0 --infer --model --plugins)");
printStream.accept("");
- printStream.accept("Default behavior: --model and --plugins are applied if no other options are specified");
+ printStream.accept("Default behavior: --model --plugins --infer are applied if no other options are specified");
printStream.accept("");
}
diff --git a/impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvnup/PluginUpgradeCliTest.java b/impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvnup/PluginUpgradeCliTest.java
index 32ad1473b9..d890d984bf 100644
--- a/impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvnup/PluginUpgradeCliTest.java
+++ b/impl/maven-cli/src/test/java/org/apache/maven/cling/invoker/mvnup/PluginUpgradeCliTest.java
@@ -18,8 +18,13 @@
*/
package org.apache.maven.cling.invoker.mvnup;
+import java.io.ByteArrayOutputStream;
+import java.nio.charset.StandardCharsets;
+
import org.apache.commons.cli.ParseException;
import org.apache.maven.api.cli.mvnup.UpgradeOptions;
+import org.apache.maven.cling.MavenUpCling;
+import org.codehaus.plexus.classworlds.ClassWorld;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -190,4 +195,25 @@ void testInterpolationWithPluginsOption() throws ParseException {
assertTrue(interpolated.plugins().isPresent(), "Interpolated options should preserve --plugins");
assertTrue(interpolated.plugins().get(), "Interpolated --plugins should be true");
}
+
+ @Test
+ void helpMentionsInferInDefault() throws Exception {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ ByteArrayOutputStream err = new ByteArrayOutputStream();
+
+ int exit = MavenUpCling.main(
+ new String[] {"--help"},
+ new ClassWorld("plexus.core", Thread.currentThread().getContextClassLoader()),
+ null,
+ out,
+ err);
+
+ String help = out.toString(StandardCharsets.UTF_8);
+ assertEquals(0, exit, "mvnup --help should exit 0");
+ assertTrue(
+ help.contains("Default behavior: --model --plugins --infer"),
+ "Help footer should advertise --infer as part of the defaults");
+ assertFalse(
+ help.contains("Default behavior: --model and --plugins"), "Old/incorrect default text must be gone");
+ }
}