java-8osgijava-9bndtools

OSGI - Java 8 -> 9 migration (Require-Capability issue)


I am trying to migrate our bnd(OSGI) project from java 8 to 9. After first fail i have prepared basic project. However, I got stuck in problems with java versions capability, exacly like bellow (just a part of them, but all are the same with difference to the java version):

! Failed to start bundle org.apache.felix.gogo.command-1.0.2, exception 

Could not resolve module: org.apache.felix.gogo.command [12]
  Unresolved requirement: Import-Package: org.apache.felix.service.command; version="[1.0.0,2.0.0)"
    -> Export-Package: org.apache.felix.service.command; bundle-symbolic-name="org.apache.felix.gogo.runtime"; bundle-version="1.0.0"; version="1.0.0"
       org.apache.felix.gogo.runtime [2]
         Unresolved requirement: Import-Package: org.osgi.service.event; version="[1.3.0,2.0.0)"; resolution:="optional"
         Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=1.7))"

org.osgi.framework.BundleException: Could not resolve module: org.apache.felix.gogo.command [12]
  Unresolved requirement: Import-Package: org.apache.felix.service.command; version="[1.0.0,2.0.0)"
    -> Export-Package: org.apache.felix.service.command; bundle-symbolic-name="org.apache.felix.gogo.runtime"; bundle-version="1.0.0"; version="1.0.0"
       org.apache.felix.gogo.runtime [2]
         Unresolved requirement: Import-Package: org.osgi.service.event; version="[1.3.0,2.0.0)"; resolution:="optional"
         Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=1.7))"

First what I have done was update all dependencies - didn't help though. I have googled a lot, but with just a few links resulted. The one which was the closest to the problem didn't help thought - I have added following lines, without result:

run.bndrun

Bundle-RequiredExecutionEnvironment: JavaSE-9
Provide-Capability: osgi.ee;osgi.ee="JavaSE";version:List="1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,9"

Maybe upgrade my bnd gradle plugin would help, however the version (I am currently using 3.5) mentioned (4.0) at readme is not available in mavenCentral.

My project specification - basic example repo

Eclipse Oxygen.3a Release (4.7.3a)
Bndtools 3.5.0.REL
Java 9.0.4+11
OSGI 6.0
Gradle 4.4
Gradle bnd plugin - 3.5

BTW: If you are trying to run project in Intellij, problems can occur - at least we didn't cope to run our main project.

Any help would be appreciated, I will do my best to provide you more info if required.

Update

Even when i delete nearly all dependencies (cleaned branch), after launch run.bndrun I am receiving only

could not resolve the bundles: [project.main-1.0.0.201804171613 org.osgi.framework.BundleException: Could not resolve module: project.main [3]
  Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=1.8))"

]

Failed to start bundle project.main-1.0.0.201804171613, exception Could not resolve module: project.main [3]
  Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=1.8))"

project.main is my only bundle.


Solution

  • As i mentioned in a comment we have dedpendency to enroute 2.0, which provides old version of org.eclipse.osgi. After manual update to 3.13 problems with Require-capability have disappeared.