gnodet opened a new pull request, #12237:
URL: https://github.com/apache/maven/pull/12237

   ## Summary
   
   Extracted from #11742 (by @arturobernalg) to keep the classloader fix 
separate from the namespace-preservation fix (#11715).
   
   When the thread context classloader cannot see the `XmlService` provider 
(e.g. in isolated plugin classloaders), the 
`ServiceLoader.load(XmlService.class)` call fails with 
`IllegalStateException("No XmlService implementation found")`.
   
   This change:
   - Tries `XmlService.class.getClassLoader()` first — this is the core realm 
classloader which always sees the provider
   - Falls back to the TCCL if the class's own classloader doesn't find it
   - The order (class CL → TCCL) is intentional: `XmlService` lives in the API 
module, and its classloader reliably sees the `impl/maven-xml` provider through 
Maven's core realm. The TCCL may be a plugin classrealm or an isolated 
classloader that cannot.
   
   ## Test plan
   
   - [x] `XmlServiceLoadingTest` verifies discovery works when TCCL is an empty 
`URLClassLoader` that cannot see the provider
   
   _Claude Code on behalf of Guillaume Nodet_
   
   Co-authored-by: Arturo Bernal <[email protected]>


-- 
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