Search code examples
osgi-bundleapache-servicemix

How to create an osgi bundle of a maven project which could be easily deployed in Servicemix


I have a maven project in my local development environment. when I run : "mvn clean install", it basically creates a JAR file inside the 'Target' directory. I have Servicemix up and running. I wanted to know if somehow I could convert this JAR to an OSGI bundle and deploy directly into ServiceMix container.

Thanks.


Solution

  • Just use the maven bundle plugin in your pom, it will embed into the build process and create a bundle of your jar (adds the required OSGi Manifest)

      <plugin>
           <groupId>org.apache.felix</groupId>
           <artifactId>maven-bundle-plugin</artifactId>
           <extensions>true</extensions>
           <configuration>
           <instructions>
                <Bundle-SymbolicName>${bundle.symbolicName}</Bundle-SymbolicName>
                <Bundle-Version>${project.version}</Bundle-Version>
           </instructions>
      </plugin>