Skip to content

Fix OSGi test setup: version syntax typo and testingBundle classpath#25

Merged
jack-berg merged 2 commits intojack-berg:osgi-supportfrom
zeitlinger:fix/osgi-version-syntax
Apr 15, 2026
Merged

Fix OSGi test setup: version syntax typo and testingBundle classpath#25
jack-berg merged 2 commits intojack-berg:osgi-supportfrom
zeitlinger:fix/osgi-version-syntax

Conversation

@zeitlinger
Copy link
Copy Markdown

Two small fixes found during review of open-telemetry#7964 (open-telemetry/opentelemetry-java).

Fix 1: Missing = in version constraint string

In otel.java-conventions.gradle.kts, the Kotlin string produced version"${@}" instead of version="${@}" — a one-character typo. The test bundle in this same PR had it right; the conventions file didn't.

BND's lenient parser accepts both forms so the generated manifest is correct either way, but the code is wrong and inconsistent.

Fix 2: testingBundle classpath causes silent test no-ops

The Bundle task uses compileClasspath by default for BND analysis. This means testImplementation dependencies are invisible to BND — including the @Testable annotation needed by the Test-Cases macro. With JUnit in testImplementation, BND can't resolve @Testable, the Test-Cases header comes out empty, 0 tests are discovered, and the task reports success regardless of whether any assertions would have failed.

Fix: add classpath(sourceSets.test.get().runtimeClasspath) to testingBundleTask, which makes testImplementation deps visible to BND and allows junit-jupiter to move back to testImplementation where it belongs.

Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
@zeitlinger zeitlinger marked this pull request as ready for review April 8, 2026 12:06
// The Bundle task uses compileClasspath by default for BND analysis (e.g. resolving the
// @Testable annotation to populate Test-Cases). Without this, testImplementation dependencies
// like junit-jupiter are invisible to BND, causing Test-Cases to be empty and 0 tests to run.
classpath(sourceSets.test.get().runtimeClasspath)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, this is what was missing for that required implementation instead of testImplementation on line 41. Thanks!

@jack-berg jack-berg merged commit 13b24db into jack-berg:osgi-support Apr 15, 2026
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.

2 participants