Build OSGI application with Maven

607 views Asked by At

I'm trying to build standalone OSGI application with Maven. There are several sub-modules containing "bundles" and one "distribution" module that produces a directory (zip) with my bundles, framework's bundles and required configuration files. The latter one declares all sub-modules and OSGI implementation as dependencies (distinct profiles for Felix and Equinox) and uses assembly plugin to put it all together.

I was able to build and run successfully only Felix version, but it's not reliable and breaks after any modification in dependencies versions due to unresolved import or incompatible versions of packages.

So here are my questions:

  1. Is Maven suitable for OSGI development at all?
  2. How to figure out which versions of bundles correspond to some version of OSGI specification and are compatible to each other?

For example, if my bundles depends on osgi.core:5.0 what jars are required at runtime org.apache.felix.framework: 5.6.1 or 4.6.0 org.apache.felix.configadmin: 1.8.12 or 1.6.0

  1. What is correct artifact names for Equinox?

There are org.eclipse.equinox:cm:3.6... and org.eclipse.equinox:org.eclipse.equinox.cm:3.6.. on the internet.

  1. What is a status of Pax project? There are not much of documentation and a lot of links are broken.
1

There are 1 answers

1
Christian Schneider On BEST ANSWER

Maven is perfectly suitable for building bundles with the help of the maven-bundle-plugin or bnd-maven-plugin.

For the assembly I recommend to either use apache karaf features and package as karaf custom distro or use an OBR index and package using bndtools.

The reason is that OSGi needs to look into the properties of the Manifest to be able to create a good deployment. Pure maven dependencies do not work well for this.