Thanks @Sn0w3y for looking into this. I know that @da-Kai also tried it before without success. There is also discussion on Java 25 support in the bndtools Github. I’d say we wait for 7.2.0.
opened 08:51AM - 06 Oct 25 UTC
As an OSGi novice, I was very confused when my tests failed on JDK-25 and the Pa… x Exam team kindly helped me [resolve](https://github.com/ops4j/org.ops4j.pax.exam/issues/1131#issuecomment-3370313321) 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.
```ini
# 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,
```kts
// 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}))""""))
}
```
Regards,
Stefan
1 Like