Skip to content

FELIX-6830 Do not include alien classpath resources when a module-info is present - #551

Merged
paulrutter merged 3 commits into
masterfrom
FELIX-6830-module-info-alien-resources
Aug 28, 2026
Merged

paulrutter merged 3 commits into
masterfrom
FELIX-6830-module-info-alien-resources

Conversation

@paulrutter

Copy link
Copy Markdown
Contributor

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

…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 and others added 2 commits August 28, 2026 10:04
…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>
@paulrutter
paulrutter merged commit 48b8b28 into master Aug 28, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant