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-mvnd.git


The following commit(s) were added to refs/heads/master by this push:
     new 0e057cb1 Make sure mvnd's plexus-interactivity is not in the maven 
classloader, fixes #807
0e057cb1 is described below

commit 0e057cb12bcd9e34db4176fbfe16c96d4092d8f8
Author: Guillaume Nodet <gno...@gmail.com>
AuthorDate: Mon Mar 13 17:15:04 2023 +0100

    Make sure mvnd's plexus-interactivity is not in the maven classloader, 
fixes #807
    
    * the logging framework is extracted into its own jar and moved in the 
mvn/lib/ directory
    * the other daemon jars are moved into the mvn/lib/mvnd directory and not 
used by maven at all
    This makes maven class loader almost identical to the stock maven 
classloader, but for the logging framework
---
 .../org/mvndaemon/mvnd/client/DaemonConnector.java |  4 +-
 daemon/pom.xml                                     | 27 ++--------
 dist-m39/src/main/provisio/maven-distro.xml        |  5 +-
 dist-m40/src/main/provisio/maven-distro.xml        |  5 +-
 dist/src/main/distro/bin/mvnd-client.conf          |  7 +--
 dist/src/main/distro/bin/mvnd-daemon.conf          |  1 +
 logging/pom.xml                                    | 58 ++++++++++++++++++++++
 .../logging/internal/MvndSlf4jConfiguration.java   |  0
 .../mvnd/logging/internal/SimpleAppender.java      |  0
 .../mvnd/logging/internal/Slf4jLogger.java         |  0
 .../mvnd/logging/internal/Slf4jLoggerManager.java  |  0
 .../mvnd/logging/smart/BuildEventListener.java     |  0
 .../logging/smart/LoggingExecutionListener.java    |  0
 .../mvnd/logging/smart/LoggingOutputStream.java    |  0
 .../logging/smart/ProjectBuildLogAppender.java     |  0
 pom.xml                                            |  6 +++
 16 files changed, 83 insertions(+), 30 deletions(-)

diff --git 
a/client/src/main/java/org/mvndaemon/mvnd/client/DaemonConnector.java 
b/client/src/main/java/org/mvndaemon/mvnd/client/DaemonConnector.java
index 0f607659..537f0bbb 100644
--- a/client/src/main/java/org/mvndaemon/mvnd/client/DaemonConnector.java
+++ b/client/src/main/java/org/mvndaemon/mvnd/client/DaemonConnector.java
@@ -346,7 +346,7 @@ public class DaemonConnector {
             String mvndAgentPath = null;
             String plexusClassworldsPath = null;
             try (DirectoryStream<Path> jarPaths = Files.newDirectoryStream(
-                    mvndHome.resolve("mvn").resolve("lib").resolve("ext"))) {
+                    mvndHome.resolve("mvn").resolve("lib").resolve("mvnd"))) {
                 for (Path jar : jarPaths) {
                     String s = jar.getFileName().toString();
                     if (s.endsWith(".jar")) {
@@ -368,7 +368,7 @@ public class DaemonConnector {
                 }
             }
             if (mvndAgentPath == null) {
-                throw new IllegalStateException("Could not find mvnd-agent jar 
in mvn/lib/ext/");
+                throw new IllegalStateException("Could not find mvnd-agent jar 
in mvn/lib/mvnd/");
             }
             if (plexusClassworldsPath == null) {
                 throw new IllegalStateException("Could not find 
plexus-classworlds jar in boot/");
diff --git a/daemon/pom.xml b/daemon/pom.xml
index 3e1ffbd8..65ccf498 100644
--- a/daemon/pom.xml
+++ b/daemon/pom.xml
@@ -45,6 +45,10 @@
       <groupId>org.apache.maven.daemon</groupId>
       <artifactId>mvnd-native</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.apache.maven.daemon</groupId>
+      <artifactId>mvnd-logging</artifactId>
+    </dependency>
     <dependency>
       <groupId>org.apache.maven</groupId>
       <artifactId>maven-embedder</artifactId>
@@ -105,29 +109,6 @@
       </resource>
     </resources>
     <plugins>
-      <plugin>
-        <artifactId>maven-compiler-plugin</artifactId>
-        <executions>
-          <execution>
-            <id>default-compile</id>
-            <goals>
-              <goal>compile</goal>
-            </goals>
-          </execution>
-          <execution>
-            <id>fallback</id>
-            <goals>
-              <goal>compile</goal>
-            </goals>
-            <configuration>
-              <release>${maven-dist.required.jdk}</release>
-              <compileSourceRoots>
-                <root>${project.basedir}/src/main/java-fallback</root>
-              </compileSourceRoots>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-surefire-plugin</artifactId>
diff --git a/dist-m39/src/main/provisio/maven-distro.xml 
b/dist-m39/src/main/provisio/maven-distro.xml
index 3798b16f..5f4c1abd 100644
--- a/dist-m39/src/main/provisio/maven-distro.xml
+++ b/dist-m39/src/main/provisio/maven-distro.xml
@@ -25,6 +25,9 @@
     </artifactSet>
 
     <artifactSet to="/mvn/lib">
+        <artifact id="org.apache.maven.daemon:mvnd-logging:${project.version}">
+            <exclusion id="*:*"/>
+        </artifact>
         <artifact id="ch.qos.logback:logback-classic">
             <exclusion id="*:*"/>
         </artifact>
@@ -36,7 +39,7 @@
         </artifact>
     </artifactSet>
 
-    <artifactSet to="/mvn/lib/ext">
+    <artifactSet to="/mvn/lib/mvnd">
         <artifact 
id="io.takari.maven:takari-smart-builder:${takari-smart-builder.version}">
             <exclusion id="*:*"/>
         </artifact>
diff --git a/dist-m40/src/main/provisio/maven-distro.xml 
b/dist-m40/src/main/provisio/maven-distro.xml
index 99673cac..c39075ef 100644
--- a/dist-m40/src/main/provisio/maven-distro.xml
+++ b/dist-m40/src/main/provisio/maven-distro.xml
@@ -25,6 +25,9 @@
     </artifactSet>
 
     <artifactSet to="/mvn/lib">
+        <artifact id="org.apache.maven.daemon:mvnd-logging:${project.version}">
+            <exclusion id="*:*"/>
+        </artifact>
         <artifact id="ch.qos.logback:logback-classic">
             <exclusion id="*:*"/>
         </artifact>
@@ -36,7 +39,7 @@
         </artifact>
     </artifactSet>
 
-    <artifactSet to="/mvn/lib/ext">
+    <artifactSet to="/mvn/lib/mvnd">
         <artifact 
id="io.takari.maven:takari-smart-builder:${takari-smart-builder.version}">
             <exclusion id="*:*"/>
         </artifact>
diff --git a/dist/src/main/distro/bin/mvnd-client.conf 
b/dist/src/main/distro/bin/mvnd-client.conf
index 35244ace..a3ea1018 100644
--- a/dist/src/main/distro/bin/mvnd-client.conf
+++ b/dist/src/main/distro/bin/mvnd-client.conf
@@ -24,6 +24,7 @@ set logback.configurationFile default 
${maven.conf}/logging/logback-client.xml
 set logback.configurationFile.fallback default 
${maven.conf}/logging/logback.xml
 
 [plexus.core]
-load ${maven.conf}/logging
-load ${maven.home}/lib/ext/*.jar
-load ${maven.home}/lib/*.jar
+load       ${maven.conf}/logging
+load       ${maven.home}/lib/mvnd/*.jar
+optionally ${maven.home}/lib/ext/*.jar
+load       ${maven.home}/lib/*.jar
diff --git a/dist/src/main/distro/bin/mvnd-daemon.conf 
b/dist/src/main/distro/bin/mvnd-daemon.conf
index 4b32b4a2..6b2173a0 100644
--- a/dist/src/main/distro/bin/mvnd-daemon.conf
+++ b/dist/src/main/distro/bin/mvnd-daemon.conf
@@ -25,5 +25,6 @@ set logback.configurationFile.fallback default 
${maven.conf}/logging/logback.xml
 
 [plexus.core]
 load       ${maven.conf}/logging
+load       ${maven.home}/lib/mvnd/*.jar
 optionally ${maven.home}/lib/ext/*.jar
 load       ${maven.home}/lib/*.jar
diff --git a/logging/pom.xml b/logging/pom.xml
new file mode 100644
index 00000000..8b1d5b9f
--- /dev/null
+++ b/logging/pom.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Copyright 2021 the original author or authors.
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.maven.daemon</groupId>
+    <artifactId>mvnd</artifactId>
+    <version>1.0.0-m5-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>mvnd-logging</artifactId>
+
+  <packaging>jar</packaging>
+  <name>Maven Daemon - Logging</name>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-embedder</artifactId>
+    </dependency>
+
+    <!-- Logging -->
+    <dependency>
+      <groupId>ch.qos.logback</groupId>
+      <artifactId>logback-classic</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>log4j-over-slf4j</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>jcl-over-slf4j</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>jul-to-slf4j</artifactId>
+    </dependency>
+  </dependencies>
+
+</project>
diff --git 
a/daemon/src/main/java/org/mvndaemon/mvnd/logging/internal/MvndSlf4jConfiguration.java
 
b/logging/src/main/java/org/mvndaemon/mvnd/logging/internal/MvndSlf4jConfiguration.java
similarity index 100%
rename from 
daemon/src/main/java/org/mvndaemon/mvnd/logging/internal/MvndSlf4jConfiguration.java
rename to 
logging/src/main/java/org/mvndaemon/mvnd/logging/internal/MvndSlf4jConfiguration.java
diff --git 
a/daemon/src/main/java-fallback/org/mvndaemon/mvnd/logging/internal/SimpleAppender.java
 b/logging/src/main/java/org/mvndaemon/mvnd/logging/internal/SimpleAppender.java
similarity index 100%
rename from 
daemon/src/main/java-fallback/org/mvndaemon/mvnd/logging/internal/SimpleAppender.java
rename to 
logging/src/main/java/org/mvndaemon/mvnd/logging/internal/SimpleAppender.java
diff --git 
a/daemon/src/main/java/org/mvndaemon/mvnd/logging/internal/Slf4jLogger.java 
b/logging/src/main/java/org/mvndaemon/mvnd/logging/internal/Slf4jLogger.java
similarity index 100%
rename from 
daemon/src/main/java/org/mvndaemon/mvnd/logging/internal/Slf4jLogger.java
rename to 
logging/src/main/java/org/mvndaemon/mvnd/logging/internal/Slf4jLogger.java
diff --git 
a/daemon/src/main/java/org/mvndaemon/mvnd/logging/internal/Slf4jLoggerManager.java
 
b/logging/src/main/java/org/mvndaemon/mvnd/logging/internal/Slf4jLoggerManager.java
similarity index 100%
rename from 
daemon/src/main/java/org/mvndaemon/mvnd/logging/internal/Slf4jLoggerManager.java
rename to 
logging/src/main/java/org/mvndaemon/mvnd/logging/internal/Slf4jLoggerManager.java
diff --git 
a/daemon/src/main/java/org/mvndaemon/mvnd/logging/smart/BuildEventListener.java 
b/logging/src/main/java/org/mvndaemon/mvnd/logging/smart/BuildEventListener.java
similarity index 100%
rename from 
daemon/src/main/java/org/mvndaemon/mvnd/logging/smart/BuildEventListener.java
rename to 
logging/src/main/java/org/mvndaemon/mvnd/logging/smart/BuildEventListener.java
diff --git 
a/daemon/src/main/java/org/mvndaemon/mvnd/logging/smart/LoggingExecutionListener.java
 
b/logging/src/main/java/org/mvndaemon/mvnd/logging/smart/LoggingExecutionListener.java
similarity index 100%
rename from 
daemon/src/main/java/org/mvndaemon/mvnd/logging/smart/LoggingExecutionListener.java
rename to 
logging/src/main/java/org/mvndaemon/mvnd/logging/smart/LoggingExecutionListener.java
diff --git 
a/daemon/src/main/java/org/mvndaemon/mvnd/logging/smart/LoggingOutputStream.java
 
b/logging/src/main/java/org/mvndaemon/mvnd/logging/smart/LoggingOutputStream.java
similarity index 100%
rename from 
daemon/src/main/java/org/mvndaemon/mvnd/logging/smart/LoggingOutputStream.java
rename to 
logging/src/main/java/org/mvndaemon/mvnd/logging/smart/LoggingOutputStream.java
diff --git 
a/daemon/src/main/java/org/mvndaemon/mvnd/logging/smart/ProjectBuildLogAppender.java
 
b/logging/src/main/java/org/mvndaemon/mvnd/logging/smart/ProjectBuildLogAppender.java
similarity index 100%
rename from 
daemon/src/main/java/org/mvndaemon/mvnd/logging/smart/ProjectBuildLogAppender.java
rename to 
logging/src/main/java/org/mvndaemon/mvnd/logging/smart/ProjectBuildLogAppender.java
diff --git a/pom.xml b/pom.xml
index f9350625..42a357ee 100644
--- a/pom.xml
+++ b/pom.xml
@@ -50,6 +50,7 @@
     <module>helper</module>
     <module>common</module>
     <module>client</module>
+    <module>logging</module>
     <module>daemon</module>
     <module>daemon-m39</module>
     <module>daemon-m40</module>
@@ -240,6 +241,11 @@
         <artifactId>mvnd-native</artifactId>
         <version>${project.version}</version>
       </dependency>
+      <dependency>
+        <groupId>org.apache.maven.daemon</groupId>
+        <artifactId>mvnd-logging</artifactId>
+        <version>${project.version}</version>
+      </dependency>
       <dependency>
         <groupId>org.apache.maven.daemon</groupId>
         <artifactId>mvnd-agent</artifactId>

Reply via email to