osgiapache-karafembedded-osgi

no osgi ready dependencies


Currently I'm working with osgi and karaf.

My problem is the no "osgi ready" dependencies , which means a jar that is not ready to be deployed as a bundle into karaf for example.

I tried two solutions in order to deal with this kind of problems :

I am not sure if I'm doing it the wrong way or what is the problem exactly. Any tips how to deal with no osgi ready dependencies ?


Solution

  • The simplest way to start is to use the wrap: protocol to auto create a jar. Behind the scenes it uses bnd to create a bundle on the fly. Simply prepend wrap: to the mvn url of the jar.

    When you try to install the jar using bundle:install -s wrap:mvn:... karaf will tell you which imported packages are missing. Install jars that provide these packages in the same way. The pom of the jar can give you a hint what is missing.

    This can mean to install lots of jars if your initial jars has lots of dependencies.

    Once you have a list of jars that are installable together you can either create a feature using wrap protocol or you can make bundles from the individual at build time.

    In any case you should take a look are the servicemix bundles. It provides OSGi ready bundles for many libraries.