This is an automated email from the ASF dual-hosted git repository.

kwin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-reporting-exec.git


The following commit(s) were added to refs/heads/master by this push:
     new 18589be  Prevent too aggressive reuse of interfaces used for 
Plexus/Sisu (#147)
18589be is described below

commit 18589be08df4effd3a504fdeeaf076c2bbe8a76e
Author: Konrad Windszus <[email protected]>
AuthorDate: Tue May 12 17:45:16 2026 +0200

    Prevent too aggressive reuse of interfaces used for Plexus/Sisu (#147)
    
    Otherwise org.apache.maven.doxia.parser.module.ParserModules/
    org.apache.maven.doxia.macro.Macros may be registered twice (through
    both m-site-p and reporting-p classloaders) for the interfaces exposed 
through
    m-s-p's classloader.
    
    This closes #141
---
 .../reporting/exec/DefaultMavenReportExecutor.java    | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git 
a/src/main/java/org/apache/maven/reporting/exec/DefaultMavenReportExecutor.java 
b/src/main/java/org/apache/maven/reporting/exec/DefaultMavenReportExecutor.java
index 3564db4..5a732a6 100644
--- 
a/src/main/java/org/apache/maven/reporting/exec/DefaultMavenReportExecutor.java
+++ 
b/src/main/java/org/apache/maven/reporting/exec/DefaultMavenReportExecutor.java
@@ -112,15 +112,24 @@ public class DefaultMavenReportExecutor implements 
MavenReportExecutor {
     private final PluginVersionResolver pluginVersionResolver;
 
     /**
-     * All packages which are imported from the Site plugin ClassRealm to the 
report plugin ClassRealm.
-     * This should correlate to the list of artifacts excluded via {@link 
#EXCLUDES} (although imports are always considered first).
+     * All packages which are imported from the Site plugin ClassRealm to the 
report plugin ClassRealm, overriding classes/packages from the actual report 
plugin classloader if any. <br>
+     * This should correlate to the list of artifacts excluded via {@link 
#EXCLUDES} (imports are always considered first).
      * The given package names are used as prefix, so all classes/resources 
from the given packages and their sub-packages are imported.
+     *
+     * The order of loading is the following:
+     * <ol>
+     * <li>imported classes/resources from the Site plugin ClassRealm (only 
the ones from the given packages/classes)</li>
+     * <li>classes/resources from the report plugin ClassRealm (except the 
ones from the given packages)</li>
+     * <li>classes/resources from the parent ClassLoader (Site plugin 
ClassRealm) (except from the EXCLUDED artifacts).</li>
+     * </ol>
      */
     private static final List<String> IMPORTS = Arrays.asList(
             "org.apache.maven.reporting",
             "org.apache.maven.doxia.siterenderer",
-            "org.apache.maven.doxia.macro",
-            "org.apache.maven.doxia.parser",
+            // prevent Macros/ParserModules from being imported and excluded 
as otherwise they might be registered
+            // twice in the MacroManager/ParserModuleManager (not separated 
between m-site-p and reporting-p)
+            // as both would implement the same interface from the m-s-p 
classloader
+            // use those in the versions being referenced in the 
reporting-plugin
             "org.apache.maven.doxia.sink",
             "org.apache.maven.doxia.util");
 
@@ -129,7 +138,7 @@ public class DefaultMavenReportExecutor implements 
MavenReportExecutor {
      * This must correlate to the list of packages imported in {@link 
#IMPORTS}.
      */
     private static final List<String> EXCLUDES =
-            Arrays.asList("doxia-sink-api", "doxia-core", 
"doxia-site-renderer", "maven-reporting-api");
+            Arrays.asList("doxia-sink-api", "doxia-site-renderer", 
"maven-reporting-api");
 
     @Inject
     public DefaultMavenReportExecutor(

Reply via email to