How to deal with transitive dependencies when osgiying a third party library with Maven Bundlor

StackOverflow https://stackoverflow.com/questions/9148077

  •  22-04-2021
  •  | 
  •  

Question

I want to use hibernate 4 in my osgi project, therefore I need to make hibernate 4 and its dependencies osgi plugins so that they are available in osgi runtime. I am using maven bundlor to do this. Because hibernate depends on several other libraries, some of which have transitive dependencies as well. Is there a way to let maven automatically finds all hibernate 4's dependencies and make all available in osgi runtime?

Thank you.

No correct solution

OTHER TIPS

Check the pax library to wrap the jars from the command line. Or if you store your artifacts in a Nexus repository, take a look at this bundle-maker plugin: it generates the bundles on the fly if they don't exist already when a dependency has a <classifier>osgi</classifier>. I use the second approach and although buggy when configuring, it does the job

As a third option, create poms that will use maven-bundle-plugin to wrap the jars. I use this approach when i need to customize the BND directives to exclude imports or change exports
The parent wrapper pom I generated from the pax-maven-plugin and each wrapped jar inherits from this pom

They all use BND internally btw

Why not use the bundles available on Maven Central? This link provides a list of all hibernate bundles. You'll notice that hibernate-core version 4.0.1.Final is available with the following maven dependency XML:

<dependency>
  <groupId>org.hibernate</groupId>
  <artifactId>hibernate-core</artifactId>
  <version>4.0.1.Final</version>
</dependency>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top