tags:

views:

130

answers:

3

How to create OSGi bundle from jar library?

+1  A: 

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 the pax-wrap-jar command.

Peter Tillemans
A: 

First check out if you can find a osgi enabled version of your library from repositories

  1. SpringSource http://www.springsource.com/repository
  2. 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.

Abdel Olakara
A: 

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.

alt text

wwerner