Maven repository to OSGi Bundle Repository

Recently, I’ve had the chance to start to work with OSGi. One of the first things that I faces was how I can prepare a local Maven repository as a local OSGi Bundle Repository (OBR). The central concept is to maintain a repository.xml as the OBR descriptor. There are several ways to do so including manually doing it. I just found out that Apache Felix has a Maven plugin called maven-bundle-plugin. In the latest version of this plugin, there is a goal bundle:index. On a project configured with you Maven repository, first configure this plugin and then run:

mvn bundle:index

This will generate a repository.xml at the root of your Maven repository. Then you can use that to feed the OSGi container that you use for bundle provisioning.