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

StackOverflow https://stackoverflow.com/questions/17529667

  •  02-06-2022
  •  | 
  •  

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.

有帮助吗?

解决方案

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>
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top