Skip to content

Restore OSGi manifest headers in the published jar - #4548

Open
RedN4ks wants to merge 1 commit into
graphql-java:masterfrom
RedN4ks:fix-osgi-manifest
Open

RedN4ks wants to merge 1 commit into
graphql-java:masterfrom
RedN4ks:fix-osgi-manifest

Conversation

@RedN4ks

@RedN4ks RedN4ks commented Nov 10, 2026

Copy link
Copy Markdown

Fixes #4547

Since the Gradle 9 upgrade (4db3cc4, #4171), the bnd configuration for shadowJar is skipped silently. The bnd builder plugin only adds BundleTaskExtension to the jar task, so extensions.findByType(BundleTaskExtension) returns null on shadowJar, and the buildBundle() step that used to run bnd was dropped. As a result, 26.0 and 26.1 were published without OSGi headers.

Changes

  • On shadowJar, create the BundleTaskExtension and register bundle.buildAction(), the bnd Gradle plugin's documented pattern for tasks other than jar. The existing bnd instructions are unchanged.
  • Set Bundle-SymbolicName and Bundle-Name to graphql-java explicitly. Otherwise bnd derives them from the archive name, which now includes the shadow classifier.
  • Add a verifyOsgiManifest task to check that fails if the published jar has the wrong Bundle-SymbolicName, no Bundle-Version, doesn't export graphql, still has Private-Package, or imports the shaded Guava or ANTLR packages.

Verification

  • ./gradlew assemble and ./gradlew check -x test -x testng pass.
  • The manifest of build/libs/graphql-java-*.jar has the same shape as 25.1: Bundle-SymbolicName: graphql-java, Export-Package: graphql;..., and imports limited to java.*, org.dataloader, org.reactivestreams and optional org.jspecify.annotations.
  • With the shadowJar change reverted, verifyOsgiManifest fails (missing Bundle-SymbolicName, Bundle-Version, Export-Package).
  • In Apache Felix 7.0.5, with java-dataloader 6.0.0, reactive-streams and jspecify installed, a bundle importing graphql and graphql.schema:
    • doesn't resolve against 26.1 (missing requirement osgi.wiring.package=graphql)
    • resolves and becomes ACTIVE against the jar built from this branch.

Since the Gradle 9 upgrade (4db3cc4), the bnd configuration for shadowJar
was silently skipped: the bnd builder plugin only adds BundleTaskExtension
to the 'jar' task, so findByType() returned null on shadowJar, and the
buildBundle() action was no longer registered. As a result 26.0 and 26.1
were published without Bundle-SymbolicName / Export-Package.

Create the extension on shadowJar explicitly and register its build action,
set Bundle-SymbolicName/Bundle-Name to graphql-java (bnd would otherwise
derive them from the classified archive name), and add a verifyOsgiManifest
check so a missing or wrong OSGi manifest fails the build.

Fixes graphql-java#4547
@RedN4ks
RedN4ks marked this pull request as ready for review November 10, 2026 10:41

This branch has not been deployed

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

OSGi manifest headers missing from published JARs since 26.0

1 participant