Skip to content

Drop unconditional osgi.cdi extender requirement from OSGi manifests - #160

Merged
vpelikh merged 1 commit into
masterfrom
fix/issue-159-osgi-cdi-extender
Aug 21, 2026
Merged

Drop unconditional osgi.cdi extender requirement from OSGi manifests#160
vpelikh merged 1 commit into
masterfrom
fix/issue-159-osgi-cdi-extender

Conversation

@vpelikh

@vpelikh vpelikh commented Aug 21, 2026

Copy link
Copy Markdown
Owner

Problem

swagger-jakarta-rest (all 4.x releases) carries a mandatory Require-Capability: osgi.extender;osgi.cdi;... header in its OSGi manifest:

Require-Capability: osgi.extender;
  beans:List<String>="io.swagger.v3.jakartarest.DefaultParameterExtension, ...";
  filter:="(&(osgi.extender=osgi.cdi)(version>=1.0.0)(!(version>=2.0.0)))"

osgi.cdi is the extender of the OSGi CDI Integration spec (Compendium R7 ch. 152), implemented by Apache Aries CDI. Because the requirement is mandatory, every consumer must supply a CDI extender — including runtimes that use Declarative Services and drive the OpenAPI Reader programmatically, where no CDI container exists or is wanted. Resolution fails on such runtimes.

Root cause

During the Jakarta EE migration (commit 93e757413), the bnd -cdiannotations directive in the root pom.xml was changed from the empty value used upstream to -cdiannotations: *.

bnd's CDIAnnotations plugin defaults this directive to * when it is absent, and with * it scans every class in the bundle and unconditionally emits the osgi.extender;osgi.cdi requirement. That made the extender dependency mandatory for every bnd-processed module, not just swagger-jakarta-rest, even though none of the modules use CDI at runtime for this path.

(The beans list the scanner produces is not a meaningful CDI bean list, e.g. it includes Reader$MethodComparator, a nested Comparator that cannot be a managed bean — it comes from scanning all classes rather than actual bean-defining annotations.)

Change

Revert -cdiannotations to the empty value used upstream:

-cdiannotations:

With an empty value bnd skips CDI annotation analysis, so no osgi.cdi extender requirement is generated. OSGi CDI deployments still work, and DS-based non-CDI runtimes resolve again.

Runtime CDI autodiscovery is unaffected: that feature is driven by the META-INF/beans.xml resource plus the CDI PortableExtension (DiscoveryTestExtension), not by bnd's annotation scan.

Fixes #159

The bnd -cdiannotations directive was set to '*' during the Jakarta
migration, which makes bnd's CDIAnnotations plugin scan every class and
unconditionally add a mandatory 'Require-Capability: osgi.extender;
...osgi.cdi' to the generated manifest of every bnd-processed module,
including swagger-jakarta-rest.

Because the requirement is mandatory, any non-CDI OSGi runtime that
drives the OpenAPI Reader programmatically (e.g. via Declarative
Services) fails to resolve the bundle, even though CDI is never used.

Revert -cdiannotations to the empty value used upstream so no CDI
extender requirement is generated. Runtime CDI autodiscovery is driven
by META-INF/beans.xml + the CDI PortableExtension and is unaffected;
CDIAutodiscoveryTest still passes.
@vpelikh
vpelikh merged commit 3f4e210 into master Aug 21, 2026
5 checks passed
@vpelikh
vpelikh deleted the fix/issue-159-osgi-cdi-extender branch August 21, 2026 10:44
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.

swagger-jakarta-rest requires the osgi.cdi extender unconditionally, which blocks non-CDI OSGi runtimes

1 participant