How to create OSGi bundle from jar library?
In case you are using eclipse: There is a wizard for that.
It allows you to select a number of jar libraries and creates a plug-in project (i.e. OSGi bundle) including these jars.
You can find it here:
File -> New -> Other ... -> Plug-in from Existing jar Archives.
In principle you just need to add OSGi metadata to the manifest
There is a bundle creator for eclipse which gives a very practical way to add these entries which should be part of the Plugin Dev Toolkit.
Here is an article detailing the process and how to do it with the Bnd tool, maven and so forth.
I personally like the pax tools very much. It is all command line based, but very practical. To create an OSGi bundle of an existing jar you can use bnd tool.
First check out if you can find a osgi enabled version of your library from repositories
- SpringSource http://www.springsource.com/repository
- Fusesource http://repo.fusesource.com/
If you don't find the OSGi enabled versions. You can go ahead with using the pax tool - PaxConstruct or use the aQute's Bnd tool.