diff --git a/daemon/src/main/java/org/apache/maven/cli/DaemonMavenInvoker.java b/daemon/src/main/java/org/apache/maven/cli/DaemonMavenInvoker.java index 50a60de06..74debb3ce 100644 --- a/daemon/src/main/java/org/apache/maven/cli/DaemonMavenInvoker.java +++ b/daemon/src/main/java/org/apache/maven/cli/DaemonMavenInvoker.java @@ -30,6 +30,7 @@ import org.apache.maven.cling.invoker.mvn.resident.ResidentMavenContext; import org.apache.maven.cling.invoker.mvn.resident.ResidentMavenInvoker; import org.apache.maven.cling.utils.CLIReportingUtils; +import org.apache.maven.execution.MavenExecutionRequest; import org.apache.maven.jline.MessageUtils; import org.apache.maven.logging.BuildEventListener; import org.apache.maven.logging.LoggingOutputStream; @@ -43,7 +44,7 @@ public DaemonMavenInvoker(ProtoLookup protoLookup) { } @Override - protected Terminal createTerminal(ResidentMavenContext context) { + protected void createTerminal(ResidentMavenContext context) { MessageUtils.systemInstall( builder -> { builder.streams( @@ -56,7 +57,12 @@ protected Terminal createTerminal(ResidentMavenContext context) { } }, terminal -> doConfigureWithTerminal(context, terminal)); - return MessageUtils.getTerminal(); + context.terminal = MessageUtils.getTerminal(); + context.closeables.add(MessageUtils::systemUninstall); + MessageUtils.registerShutdownHook(); + if (context.coloredOutput != null) { + MessageUtils.setColorEnabled(context.coloredOutput); + } } @Override @@ -121,7 +127,7 @@ protected ContainerCapsuleFactory createContainerCapsuleFa } @Override - protected int doExecute(ResidentMavenContext context) throws Exception { + protected int doExecute(ResidentMavenContext context, MavenExecutionRequest request) throws Exception { context.logger.info(MessageUtils.builder() .a("Processing build on daemon ") .strong(Environment.MVND_ID.asString()) @@ -134,7 +140,7 @@ protected int doExecute(ResidentMavenContext context) throws Exception { context.logger.info("rootDirectory: " + context.invokerRequest.rootDirectory()); try { - return super.doExecute(context); + return super.doExecute(context, request); } finally { LoggingOutputStream.forceFlush(System.out); LoggingOutputStream.forceFlush(System.err); diff --git a/pom.xml b/pom.xml index e5b4404dc..df2ec8563 100644 --- a/pom.xml +++ b/pom.xml @@ -83,7 +83,7 @@ 4.0.24 2.4.1 3.27.1 - 4.0.0-beta-6-20241113.142745-2 + 4.0.0-beta-6-SNAPSHOT 3.9.9