Repository navigation
FELIX-6830 Do not include alien classpath resources when a module-info is present - #551
Merged
Merged
Conversation
…o is present A project's module-info.class is compiled into the default (root) package of the output directory. addLocalPackages() scanned **/*.class and therefore 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 such as the beans_*.xsd and validation-*.xsd files that jakarta.enterprise.cdi-api and jakarta.validation-api keep at their jar root. Exclude module-info.class from the local package scan so the default package is no longer treated as a private package, and re-add module-info.class as an explicit resource so the bundle keeps its module descriptor without pulling in the alien resources. Adds the module-info-no-alien-resources integration test. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
paulrutter
force-pushed
the
FELIX-6830-module-info-alien-resources
branch
from
August 28, 2026 07:57
b988a4b to
593f00d
Compare
…nfo-alien-resources # Conflicts: # tools/maven-bundle-plugin/changelog.txt
bnd is upgraded to 7.4.0 in this release, so the next release becomes 6.2.0 instead of 6.1.4. Update the changelog section header and the README upgrade notice accordingly. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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: jakartaee/mvc#73 (comment)
Root cause
A project's
module-info.classis compiled into the default (root) package of the output directory.addLocalPackages()scans**/*.class, so it added the default package.toPrivate-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. thebeans_*.xsdfiles at the root ofjakarta.enterprise.cdi-apiand thevalidation-*.xsdfiles at the root ofjakarta.validation-api.Without a
module-info, nothing lives in the root package, so.is never added and the copy never happens.Fix
module-info.classfrom the local package scan, so the default package is no longer treated as a private package.module-info.classas an explicitInclude-Resource, so the bundle keeps its module descriptor without pulling in the alien resources.Verification
module-info-no-alien-resources(module-info +jakarta.enterprise.cdi-api) asserts thebeans_*.xsddo not leak in, whilemodule-info.classand 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