paulrutter opened a new pull request, #551:
URL: https://github.com/apache/felix-dev/pull/551

   Fixes the inclusion of unrelated (alien) root-level resources from classpath 
dependencies when a project ships a `module-info.java`.
   
   JIRA: https://issues.apache.org/jira/browse/FELIX-6830
   Reported via: 
https://github.com/jakartaee/mvc/pull/73#issuecomment-2934163673
   
   ## Root cause
   A project's `module-info.class` is compiled into the **default (root) 
package** of the output directory. `addLocalPackages()` scans `**/*.class`, so 
it added the default package `.` to `Private-Package`. When bnd expands that 
package it copies the default (root) package of **every** jar on the bnd 
classpath into the bundle, dragging in unrelated root-level resources — e.g. 
the `beans_*.xsd` files at the root of `jakarta.enterprise.cdi-api` and the 
`validation-*.xsd` files at the root of `jakarta.validation-api`.
   
   Without a `module-info`, nothing lives in the root package, so `.` is never 
added and the copy never happens.
   
   ## Fix
   - Exclude `module-info.class` from the local package scan, so the default 
package is no longer treated as a private package.
   - Re-add `module-info.class` as an explicit `Include-Resource`, so the 
bundle keeps its module descriptor without pulling in the alien resources.
   
   ## Verification
   - New integration test `module-info-no-alien-resources` (module-info + 
`jakarta.enterprise.cdi-api`) asserts the `beans_*.xsd` do **not** leak in, 
while `module-info.class` and the project's own classes are retained. It fails 
before the fix and passes after.
   - `mvn verify` → BUILD SUCCESS, 12/12 integration tests pass, RAT clean.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


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