8

When building my OSGi bundles with JDK 10, maven-bundle-plugin (3.5.1) generates the following manifest attribute:

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

This fails runtime:

Unresolved requirements: [[com.mycompany.mybundle [1](R 1.0)] osgi.ee; (osgi.ee=UNKNOWN)]

When building with JDK 9, I get the expected:

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

I set the source and target versions for maven-compiler-plugin to '1.9' and '10' respectively.

At the moment, I'm using a workaround to stop the plugin from adding osgi.ee to the manifest:

<configuration>
  <instructions>
      <_noee>true</_noee>
  </instructions>
</configuration>

.. but I would rather have the correct Java 10 requirement.

gjoranv
  • 4,376
  • 3
  • 21
  • 37

1 Answers1

9

You need a more recent version of maven-bundle-plugin based upon Bnd 4.0 which added support for Java 10 class files.

BJ Hargrave
  • 9,324
  • 1
  • 19
  • 27
  • 2
    It turns out the latest version of maven-bundle-plugin available as of today is 3.5.1 which is only based upon Bnd 3.5. So you need to get the maven-bundle-plugin devs to update. Or you can migrate to bnd-maven-plugin from the Bnd team. But note that is it configured and operates in a different way than maven-bundle-plugin. – BJ Hargrave Jul 03 '18 at 13:17
  • 1
    Thanks, I created https://issues.apache.org/jira/browse/FELIX-5879 to follow up with the Felix team. – gjoranv Jul 05 '18 at 22:45