Re: [PR] Upgrade to beta-6 [maven-mvnd]

2024-11-22 Thread via GitHub


gnodet commented on code in PR #1189:
URL: https://github.com/apache/maven-mvnd/pull/1189#discussion_r1854605579


##
daemon/src/main/java/org/apache/maven/cli/DaemonMavenOptions.java:
##
@@ -24,7 +24,6 @@
 import org.apache.maven.api.cli.mvn.MavenOptions;
 
 public interface DaemonMavenOptions extends MavenOptions {
-

Review Comment:
   That's kind expected, as mvnd specific options (such as `--stop`) are 
handled differently at the very beginning, or via system properties.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Upgrade to beta-6 [maven-mvnd]

2024-11-22 Thread via GitHub


cstamas commented on code in PR #1189:
URL: https://github.com/apache/maven-mvnd/pull/1189#discussion_r1854585182


##
daemon/src/main/java/org/apache/maven/cli/DaemonMavenInvoker.java:
##
@@ -18,68 +18,60 @@
  */
 package org.apache.maven.cli;
 
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
 import java.io.OutputStream;
 import java.io.PrintStream;
-import java.io.PrintWriter;
-import java.nio.charset.StandardCharsets;
+import java.util.Optional;
 
+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.api.cli.mvn.MavenInvokerRequest;
-import org.apache.maven.api.cli.mvn.MavenOptions;
-import org.apache.maven.api.services.MavenException;
 import org.apache.maven.cling.invoker.ContainerCapsuleFactory;
 import org.apache.maven.cling.invoker.ProtoLookup;
-import org.apache.maven.cling.invoker.mvn.resident.DefaultResidentMavenInvoker;
+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;
 import org.jline.terminal.Terminal;
-import org.jline.terminal.impl.ExternalTerminal;
+import org.jline.terminal.TerminalBuilder;
 import org.mvndaemon.mvnd.common.Environment;
 
-public class DaemonMavenInvoker extends DefaultResidentMavenInvoker {
+public class DaemonMavenInvoker extends ResidentMavenInvoker {
 public DaemonMavenInvoker(ProtoLookup protoLookup) {
 super(protoLookup);
 }
 
-// TODO: this is a hack, and fixes issue in DefaultResidentMavenInvoker 
that does not copy TCCL
-private ClassLoader tccl;
-
-protected int doInvoke(LocalContext context) throws Exception {
-try {
-if (tccl != null) {
-context.currentThreadContextClassLoader = tccl;
-
Thread.currentThread().setContextClassLoader(context.currentThreadContextClassLoader);
-}
-return super.doInvoke(context);
-} finally {
-this.tccl = context.currentThreadContextClassLoader;
+@Override
+protected void createTerminal(ResidentMavenContext context) {
+MessageUtils.systemInstall(
+builder -> {
+builder.streams(
+context.invokerRequest.in().orElseThrow(),
+context.invokerRequest.out().orElseThrow());
+
builder.systemOutput(TerminalBuilder.SystemOutput.ForcedSysOut);
+builder.provider(TerminalBuilder.PROP_PROVIDER_EXEC);
+if (context.coloredOutput != null) {
+builder.color(context.coloredOutput);
+}
+},
+terminal -> doConfigureWithTerminal(context, terminal));
+context.terminal = MessageUtils.getTerminal();
+context.closeables.add(MessageUtils::systemUninstall);
+MessageUtils.registerShutdownHook();

Review Comment:
   I'd leave all this as is, as shutdown hook is also removed on uninstall, 
hence IMO we are ok. Also, mvnd creates "exec" terminal while mvn not.
   
   We can further simplify later.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Upgrade to beta-6 [maven-mvnd]

2024-11-22 Thread via GitHub


cstamas commented on code in PR #1189:
URL: https://github.com/apache/maven-mvnd/pull/1189#discussion_r1854549680


##
daemon/src/main/java/org/apache/maven/cli/DaemonMavenOptions.java:
##
@@ -24,7 +24,6 @@
 import org.apache.maven.api.cli.mvn.MavenOptions;
 
 public interface DaemonMavenOptions extends MavenOptions {
-

Review Comment:
   Am unsure about the existence of this class. DaemonMavenOptions was 
introduced to add new CLI options like "raw streams", but today, no new option 
in mvnd exists...



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Upgrade to beta-6 [maven-mvnd]

2024-11-22 Thread via GitHub


gnodet commented on code in PR #1189:
URL: https://github.com/apache/maven-mvnd/pull/1189#discussion_r1854549764


##
daemon/src/main/java/org/apache/maven/cli/DaemonMavenInvoker.java:
##
@@ -18,68 +18,60 @@
  */
 package org.apache.maven.cli;
 
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
 import java.io.OutputStream;
 import java.io.PrintStream;
-import java.io.PrintWriter;
-import java.nio.charset.StandardCharsets;
+import java.util.Optional;
 
+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.api.cli.mvn.MavenInvokerRequest;
-import org.apache.maven.api.cli.mvn.MavenOptions;
-import org.apache.maven.api.services.MavenException;
 import org.apache.maven.cling.invoker.ContainerCapsuleFactory;
 import org.apache.maven.cling.invoker.ProtoLookup;
-import org.apache.maven.cling.invoker.mvn.resident.DefaultResidentMavenInvoker;
+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;
 import org.jline.terminal.Terminal;
-import org.jline.terminal.impl.ExternalTerminal;
+import org.jline.terminal.TerminalBuilder;
 import org.mvndaemon.mvnd.common.Environment;
 
-public class DaemonMavenInvoker extends DefaultResidentMavenInvoker {
+public class DaemonMavenInvoker extends ResidentMavenInvoker {
 public DaemonMavenInvoker(ProtoLookup protoLookup) {
 super(protoLookup);
 }
 
-// TODO: this is a hack, and fixes issue in DefaultResidentMavenInvoker 
that does not copy TCCL
-private ClassLoader tccl;
-
-protected int doInvoke(LocalContext context) throws Exception {
-try {
-if (tccl != null) {
-context.currentThreadContextClassLoader = tccl;
-
Thread.currentThread().setContextClassLoader(context.currentThreadContextClassLoader);
-}
-return super.doInvoke(context);
-} finally {
-this.tccl = context.currentThreadContextClassLoader;
+@Override
+protected void createTerminal(ResidentMavenContext context) {
+MessageUtils.systemInstall(
+builder -> {
+builder.streams(
+context.invokerRequest.in().orElseThrow(),
+context.invokerRequest.out().orElseThrow());
+
builder.systemOutput(TerminalBuilder.SystemOutput.ForcedSysOut);
+builder.provider(TerminalBuilder.PROP_PROVIDER_EXEC);
+if (context.coloredOutput != null) {
+builder.color(context.coloredOutput);
+}
+},
+terminal -> doConfigureWithTerminal(context, terminal));
+context.terminal = MessageUtils.getTerminal();
+context.closeables.add(MessageUtils::systemUninstall);
+MessageUtils.registerShutdownHook();

Review Comment:
   Maven 3 did not create a `Terminal`, so this was needed. But now it should 
go away.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Upgrade to beta-6 [maven-mvnd]

2024-11-22 Thread via GitHub


cstamas commented on code in PR #1189:
URL: https://github.com/apache/maven-mvnd/pull/1189#discussion_r1854547641


##
daemon/src/main/java/org/apache/maven/cli/DaemonMavenInvoker.java:
##
@@ -18,68 +18,60 @@
  */
 package org.apache.maven.cli;
 
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
 import java.io.OutputStream;
 import java.io.PrintStream;
-import java.io.PrintWriter;
-import java.nio.charset.StandardCharsets;
+import java.util.Optional;
 
+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.api.cli.mvn.MavenInvokerRequest;
-import org.apache.maven.api.cli.mvn.MavenOptions;
-import org.apache.maven.api.services.MavenException;
 import org.apache.maven.cling.invoker.ContainerCapsuleFactory;
 import org.apache.maven.cling.invoker.ProtoLookup;
-import org.apache.maven.cling.invoker.mvn.resident.DefaultResidentMavenInvoker;
+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;
 import org.jline.terminal.Terminal;
-import org.jline.terminal.impl.ExternalTerminal;
+import org.jline.terminal.TerminalBuilder;
 import org.mvndaemon.mvnd.common.Environment;
 
-public class DaemonMavenInvoker extends DefaultResidentMavenInvoker {
+public class DaemonMavenInvoker extends ResidentMavenInvoker {
 public DaemonMavenInvoker(ProtoLookup protoLookup) {
 super(protoLookup);
 }
 
-// TODO: this is a hack, and fixes issue in DefaultResidentMavenInvoker 
that does not copy TCCL
-private ClassLoader tccl;
-
-protected int doInvoke(LocalContext context) throws Exception {
-try {
-if (tccl != null) {
-context.currentThreadContextClassLoader = tccl;
-
Thread.currentThread().setContextClassLoader(context.currentThreadContextClassLoader);
-}
-return super.doInvoke(context);
-} finally {
-this.tccl = context.currentThreadContextClassLoader;
+@Override
+protected void createTerminal(ResidentMavenContext context) {
+MessageUtils.systemInstall(
+builder -> {
+builder.streams(
+context.invokerRequest.in().orElseThrow(),
+context.invokerRequest.out().orElseThrow());
+
builder.systemOutput(TerminalBuilder.SystemOutput.ForcedSysOut);
+builder.provider(TerminalBuilder.PROP_PROVIDER_EXEC);
+if (context.coloredOutput != null) {
+builder.color(context.coloredOutput);
+}
+},
+terminal -> doConfigureWithTerminal(context, terminal));
+context.terminal = MessageUtils.getTerminal();
+context.closeables.add(MessageUtils::systemUninstall);
+MessageUtils.registerShutdownHook();

Review Comment:
   We should remove this from here, and install it **only once** in 
LookupInvoker maybe?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Upgrade to beta-6 [maven-mvnd]

2024-11-22 Thread via GitHub


gnodet commented on PR #1189:
URL: https://github.com/apache/maven-mvnd/pull/1189#issuecomment-2494636839

   Fixes #1203 and #1204.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Upgrade to beta-6 [maven-mvnd]

2024-11-22 Thread via GitHub


cstamas commented on code in PR #1189:
URL: https://github.com/apache/maven-mvnd/pull/1189#discussion_r1854546540


##
.mvn/maven.config:
##
@@ -1,3 +1,4 @@
 -Dmaven.wagon.httpconnectionManager.ttlSeconds=120
 -Dmaven.wagon.http.retryHandler.requestSentEnabled=true
 -Dmaven.wagon.http.retryHandler.count=10
+-Daether.transport.jdk.httpVersion=HTTP_1_1

Review Comment:
   In fact, all of these can go away, wagon is not used anymore, is it?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Upgrade to beta-6 [maven-mvnd]

2024-11-22 Thread via GitHub


cstamas commented on code in PR #1189:
URL: https://github.com/apache/maven-mvnd/pull/1189#discussion_r1854546299


##
.mvn/maven.config:
##
@@ -1,3 +1,4 @@
 -Dmaven.wagon.httpconnectionManager.ttlSeconds=120
 -Dmaven.wagon.http.retryHandler.requestSentEnabled=true
 -Dmaven.wagon.http.retryHandler.count=10
+-Daether.transport.jdk.httpVersion=HTTP_1_1

Review Comment:
   This can go away now with Resolver 2.0.4 (mvn 4-beta-6)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Upgrade to beta-6 [maven-mvnd]

2024-11-22 Thread via GitHub


cstamas commented on PR #1189:
URL: https://github.com/apache/maven-mvnd/pull/1189#issuecomment-2494634336

   All looks good, tested locally.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Upgrade to beta-6 [maven-mvnd]

2024-11-13 Thread via GitHub


cstamas commented on PR #1189:
URL: https://github.com/apache/maven-mvnd/pull/1189#issuecomment-2473986446

   All fine, manually tested as well, but one problem (and related IT) fails: 
raw streams
   ```
   RawStreamsTest.version:55 Output should contain PrintOut{payload='Hello'} 
==> expected:  but was: 
   ```
   
   IMO this is a problem in maven and not mvnd.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org