How to find an OSGi bundle providing a specific capability (JavaEL 5.0)

137 Views Asked by At

I am using Felix implementation of OSGi. I have a plugin I wrote which uses hibernate-validator:

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-validator</artifactId>
    <version>8.0.0.Final</version>
</dependency>

I use the bnd-process goal of the biz.aQute.bnd:bnd-maven-plugin plugin to package that bundle. When opening the MANIFEST.MF generated, I find the following entry:

Require-Capability: osgi.extender;filter:="(&(osgi.extender=osgi.compone
 nt)(version>=1.5.0)(!(version>=2.0.0)))",osgi.contract;osgi.contract=Ja
 vaEL;filter:="(&(osgi.contract=JavaEL)(version=5.0.0))",osgi.ee;filter:
 ="(&(osgi.ee=JavaSE)(version=17))"

Notice the osgi.contract;osgi.contract=JavaEL;filter:="(&(osgi.contract=JavaEL)(version=5.0.0))" part. Now if I look at https://docs.osgi.org/reference/portable-java-contracts.html#jakarta-ee-contracts, I only find either Jakarta Expression Language in version 5.0 or JavaEL in version 3.0. There is no such JavaEL in 5.0 version.

I found the "hard way" that I need to add:

<dependency>
  <groupId>jakarta.el</groupId>
  <artifactId>jakarta.el-api</artifactId>
  <version>5.0.0</version>
</dependency>

to my pom.xml and ,jakarta.el;version="5.0.0" to my Private-Package bnd configuration of the bnd-maven-plugin, but I wonder whether there is an easier way.

Now what is annoying me is that my core application has the Jakarta Expression Language version 5.0 as its available capability, but not JavaEL 5.0, so I need to declare that dependency in each of my plugins (some of which I do not even control the development flow).

Hence my questions:

  • Is this a bug in the capability resolution engine in the bnd-maven-plugin after the infamous javax renaming into jakarta?
  • Is there any way I can avoid my plugins to explicitly import jakarta-el when my core application has the capability, but with a different name?
  • Or am I doing something wrong somehow?
0

There are 0 best solutions below