From ecc9f1c6b11b1f5f955d06d43fdec94b9e7b18e0 Mon Sep 17 00:00:00 2001 From: Konrad Windszus Date: Tue, 12 May 2026 16:31:51 +0200 Subject: [PATCH 1/2] Prevent too aggressive reuse of interfaces used for Plexus/Sisu components 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) This closes #141 --- .../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..e45b067 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.
+ * 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: + *
    + *
  1. imported classes/resources from the Site plugin ClassRealm (only the ones from the given packages/classes)
  2. + *
  3. classes/resources from the report plugin ClassRealm (except the ones from the given packages)
  4. + *
  5. classes/resources from the parent ClassLoader (Site plugin ClassRealm) (except from the EXCLUDED artifacts).
  6. + *
*/ private static final List IMPORTS = Arrays.asList( "org.apache.maven.reporting", "org.apache.maven.doxia.siterenderer", - "org.apache.maven.doxia.macro", - "org.apache.maven.doxia.parser", + // prevent macros/parsers from being imported, as otherwise the Doxia macros/modules 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 "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 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( From a55d285a3e1a6e798d68d60921f0e27baa233461 Mon Sep 17 00:00:00 2001 From: Konrad Windszus Date: Tue, 12 May 2026 16:45:31 +0200 Subject: [PATCH 2/2] cleanup javadoc --- .../maven/reporting/exec/DefaultMavenReportExecutor.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 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 e45b067..5a732a6 100644 --- a/src/main/java/org/apache/maven/reporting/exec/DefaultMavenReportExecutor.java +++ b/src/main/java/org/apache/maven/reporting/exec/DefaultMavenReportExecutor.java @@ -126,10 +126,10 @@ public class DefaultMavenReportExecutor implements MavenReportExecutor { private static final List IMPORTS = Arrays.asList( "org.apache.maven.reporting", "org.apache.maven.doxia.siterenderer", - // prevent macros/parsers from being imported, as otherwise the Doxia macros/modules 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 + // 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");