gnodet opened a new issue, #12353:
URL: https://github.com/apache/maven/issues/12353

   ## Description
   
   `jaxb2-maven-plugin:3.1.0` (and likely 4.x) fails under Maven 4 with a 
`ClassNotFoundException` for 
`org.glassfish.jaxb.core.v2.model.core.package-info`. The JAXB runtime's 
`package-info` classes are not visible in the plugin's classrealm.
   
   ## Error
   
   ```
   [ERROR] Failed to execute goal 
org.codehaus.mojo:jaxb2-maven-plugin:3.1.0:schemagen (schemagen) on project 
optaplanner-core-impl:
     Unable to load the mojo 'schemagen' in the plugin 
'org.codehaus.mojo:jaxb2-maven-plugin:3.1.0'.
     A required class is missing: 
org.glassfish.jaxb.core.v2.model.core.package-info
   -----------------------------------------------------
   realm =    plugin>org.codehaus.mojo:jaxb2-maven-plugin:3.1.0
   strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
   urls[0] = file:...jaxb2-maven-plugin-3.1.0.jar
   urls[1] = file:...jaxb-xjc-3.0.0.jar
   urls[2] = file:...jaxb-jxc-3.0.0.jar
   ...
   Number of foreign imports: 1
   import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
   ```
   
   ## Root cause
   
   Maven 4's classrealm construction for plugins filters or doesn't expose 
`package-info` classes from transitive dependencies. The `jaxb-core` jar is 
either not included in the plugin classrealm or its `package-info` classes are 
not accessible due to the module/package filtering in `maven.api`.
   
   The same build succeeds with Maven 3, where the plugin classrealm 
construction is more permissive.
   
   ## Reproducer
   
   ```bash
   git clone https://github.com/apache/incubator-kie-optaplanner.git
   cd incubator-kie-optaplanner
   mvn -B -e clean package -DskipTests
   ```
   
   The `schemagen` goal on `optaplanner-core-impl` fails.
   
   ## Context
   
   Found during [Maven 4 compatibility 
testing](https://github.com/gnodet/maven4-testing/issues/13307) of Apache 
projects.
   
   _Claude Code on behalf of Guillaume Nodet_


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to