Skip to content

Can the osgi.ee=JavaSE be more lenient on unknown JDK versions? #6858

@ben-manes

Description

@ben-manes

As an OSGi novice, I was very confused when my tests failed on JDK-25 and the Pax Exam team kindly helped me resolve that setting the Require-Capability explicitly. Since this is just the Java version can that be added dynamically instead of osgi.ee;filter:="(osgi.ee=UNKNOWN)"? Then the bnd plugin is future compatible. While I release on JDK-11, the tests failed due to cross-building on the latest JDK.

# Java 24
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=24))"

# Java 25
Require-Capability: osgi.ee;filter:="(osgi.ee=UNKNOWN)"

I manually forced the correct value using,

// Workaround until the bnd plugin supports the latest JDK
val javaVersion = java.toolchain.languageVersion.get()
if (javaVersion.canCompileOrRun(25)) {
  bnd(mapOf("Require-Capability" to
    """osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=${javaVersion}))""""))
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions