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