Question

I'm adapting an existing collection of libraries, building them as OSGi bundles. It's a multi-module Maven project, with several layers of POM inheritance and aggregation. Ideally, plugin configuration would be placed in parent POMs only.

The project is composed of more than 100 jars. There's already a mega bundle that encompasses the entire library and export all packages. My effort aims at making the library more modular, which is the main reason of having them as OSGi bundles in the first place.

The main issue is this library has a split package nightmare, and I cannot change the package structure. I'm trying to solve the issue using Require-Bundle, as recommended in the book OSGi in Action, even though the book mentions it's not a good practice. I tried the recommendation of using an arbitrary attribute named "split" in Import-Package to separate parts of a bundle and only import certain packages. But due to the number of bundles providing the same package, that turned out to be too complicated to configure.

My question is how to configure the maven-bundle-plugin <Require-Bundle> directive, if at all possible, to use wildcards (e.g. *) as a form of telling it to use all Maven dependencies, instead of having to manually list all bundles names and versions; i.e. is there an alternative to this:

<Require-Bundle>lib-api; version=${project.version}</Require-Bundle>

that uses some kind of wildcard matching and that could be put in a parent POM?

Was it helpful?

Solution

In short, no. bnd has no support for Require-Bundle, it treats it as a normal header.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top