You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by cs...@apache.org on 2024/08/27 16:38:29 UTC
(maven) branch maven-cling updated: Fixes
This is an automated email from the ASF dual-hosted git repository.
cstamas pushed a commit to branch maven-cling
in repository https://gitbox.apache.org/repos/asf/maven.git
The following commit(s) were added to refs/heads/maven-cling by this push:
new a7f0f8da12 Fixes
a7f0f8da12 is described below
commit a7f0f8da1253b8ff48893a4b443a793b9f39f123
Author: Tamas Cservenak <ta...@cservenak.net>
AuthorDate: Tue Aug 27 18:37:05 2024 +0200
Fixes
---
maven-cli/src/main/java/org/apache/maven/cling/MavenCling.java | 6 +++++-
.../src/main/java/org/apache/maven/cling/MavenClingOptions.java | 2 +-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/maven-cli/src/main/java/org/apache/maven/cling/MavenCling.java b/maven-cli/src/main/java/org/apache/maven/cling/MavenCling.java
index 8f7b8b18ea..186f03d3ed 100644
--- a/maven-cli/src/main/java/org/apache/maven/cling/MavenCling.java
+++ b/maven-cli/src/main/java/org/apache/maven/cling/MavenCling.java
@@ -21,6 +21,7 @@ package org.apache.maven.cling;
import javax.tools.Tool;
import java.io.PrintStream;
+import java.util.Arrays;
import java.util.Collections;
import java.util.function.Consumer;
@@ -76,7 +77,10 @@ public class MavenCling extends MavenClingSupport<MavenClingOptions> implements
@Override
protected int doRun(MavenClingOptions options, Consumer<PrintStream> usage, String... args) {
if (options.isLegacyCli()) {
- return MavenCli.main(args, classWorld); // just delegate it
+ // just delegate it: but filter out one command legacy does not know
+ // TODO: how to not duplicate string literal here?
+ return MavenCli.main(
+ Arrays.stream(args).filter(a -> !a.equals("--legacy-cli")).toArray(String[]::new), classWorld);
} else {
if (options.isShowVersionAndExit()) {
if (options.isQuiet()) {
diff --git a/maven-cli/src/main/java/org/apache/maven/cling/MavenClingOptions.java b/maven-cli/src/main/java/org/apache/maven/cling/MavenClingOptions.java
index d3a38ab34b..d6591bac70 100644
--- a/maven-cli/src/main/java/org/apache/maven/cling/MavenClingOptions.java
+++ b/maven-cli/src/main/java/org/apache/maven/cling/MavenClingOptions.java
@@ -31,7 +31,7 @@ public class MavenClingOptions extends MavenOptionsSupport {
*/
@Experimental
@Option(
- names = {"-lc", "--legacy-cli"},
+ names = {"--legacy-cli"},
arity = "0",
description = "Use legacy CLI")
protected boolean legacyCli;