Upgrade to Maven 4.0.0-rc-4 (#1347)
Some checks failed
Stale / stale (push) Has been cancelled
Early Access / Default build (without GraalVM) (push) Has been cancelled
Early Access / Build with GraalVM on macos-13 (push) Has been cancelled
Early Access / Build with GraalVM on macos-latest (push) Has been cancelled
Early Access / Build with GraalVM on ubuntu-latest (push) Has been cancelled
Early Access / Build with GraalVM on windows-latest (push) Has been cancelled
Early Access / Site build (push) Has been cancelled

This commit is contained in:
Tamas Cservenak
2025-07-19 00:59:54 +02:00
committed by GitHub
parent 90bc22eb2c
commit f0a22cb367
4 changed files with 25 additions and 17 deletions

View File

View File

@@ -48,10 +48,13 @@ public class DaemonMavenCling implements DaemonCli {
public DaemonMavenCling() {
this.parser = new DaemonMavenParser();
this.invoker = new DaemonMavenInvoker(ProtoLookup.builder()
.addMapping(
ClassWorld.class, ((ClassRealm) Thread.currentThread().getContextClassLoader()).getWorld())
.build());
this.invoker = new DaemonMavenInvoker(
ProtoLookup.builder()
.addMapping(
ClassWorld.class,
((ClassRealm) Thread.currentThread().getContextClassLoader()).getWorld())
.build(),
null);
}
@Override

View File

@@ -20,11 +20,13 @@ package org.apache.maven.cli;
import java.io.OutputStream;
import java.io.PrintStream;
import java.util.function.Consumer;
import org.apache.maven.api.annotations.Nullable;
import org.apache.maven.api.cli.InvokerException;
import org.apache.maven.api.cli.InvokerRequest;
import org.apache.maven.api.cli.Options;
import org.apache.maven.cling.invoker.ContainerCapsuleFactory;
import org.apache.maven.cling.invoker.LookupContext;
import org.apache.maven.cling.invoker.ProtoLookup;
import org.apache.maven.cling.invoker.mvn.MavenContext;
import org.apache.maven.cling.invoker.mvn.resident.ResidentMavenInvoker;
@@ -37,8 +39,8 @@ import org.jline.terminal.TerminalBuilder;
import org.mvndaemon.mvnd.common.Environment;
public class DaemonMavenInvoker extends ResidentMavenInvoker {
public DaemonMavenInvoker(ProtoLookup protoLookup) {
super(protoLookup);
public DaemonMavenInvoker(ProtoLookup protoLookup, @Nullable Consumer<LookupContext> contextConsumer) {
super(protoLookup, contextConsumer);
}
@Override
@@ -81,12 +83,12 @@ public class DaemonMavenInvoker extends ResidentMavenInvoker {
InvokerRequest invokerRequest = context.invokerRequest;
BuildEventListener buildEventListener =
context.invokerRequest.parserRequest().lookup().lookup(BuildEventListener.class);
if (invokerRequest.options().help().isPresent()) {
context.invokerRequest.options().displayHelp(invokerRequest.parserRequest(), buildEventListener::log);
if (context.options().help().isPresent()) {
context.options().displayHelp(invokerRequest.parserRequest(), buildEventListener::log);
throw new InvokerException.ExitException(0);
}
if (invokerRequest.options().showVersionAndExit().isPresent()) {
if (invokerRequest.options().quiet().orElse(false)) {
if (context.options().showVersionAndExit().isPresent()) {
if (context.options().quiet().orElse(false)) {
buildEventListener.log(CLIReportingUtils.showVersionMinimal());
} else {
buildEventListener.log(CLIReportingUtils.showVersion());
@@ -97,8 +99,8 @@ public class DaemonMavenInvoker extends ResidentMavenInvoker {
@Override
protected void preCommands(MavenContext context) throws Exception {
Options mavenOptions = context.invokerRequest.options();
if (mavenOptions.verbose().orElse(false) || mavenOptions.showVersion().orElse(false)) {
if (context.options().verbose().orElse(false)
|| context.options().showVersion().orElse(false)) {
context.invokerRequest
.parserRequest()
.lookup()

11
pom.xml
View File

@@ -83,16 +83,16 @@
<groovy.version>4.0.27</groovy.version>
<jansi.version>2.4.1</jansi.version>
<jline.version>3.30.4</jline.version>
<maven.version>4.0.0-rc-3</maven.version>
<required-maven.version>3.9.9</required-maven.version>
<maven.version>4.0.0-rc-4</maven.version>
<required-maven.version>3.9.10</required-maven.version>
<!-- Keep in sync with Maven -->
<maven.resolver.version>2.0.10</maven.resolver.version>
<slf4j.version>2.0.16</slf4j.version>
<slf4j.version>2.0.17</slf4j.version>
<sisu.version>0.9.0.M4</sisu.version>
<maven.plugin-tools.version>3.15.1</maven.plugin-tools.version>
<version.plexus-utils>4.0.2</version.plexus-utils>
<version.plexus-xml>4.0.4</version.plexus-xml>
<version.plexus-xml>4.1.0</version.plexus-xml>
<jakarta.inject.version>2.0.1</jakarta.inject.version>
<version.maven-fluido-skin>2.1.0</version.maven-fluido-skin>
@@ -109,6 +109,9 @@
<takari-smart-builder.version>1.1.0</takari-smart-builder.version>
<testcontainers.version>1.21.3</testcontainers.version>
<xstream.version>1.4.21</xstream.version>
<!-- from parent -->
<versions.junit5>5.13.1</versions.junit5>
</properties>
<dependencyManagement>