Create OSGI bundle from plain java maven project

36 views Asked by At

I've got maven project (non Spring one), what should I change inside my pom.xml to build jar to be executable by SMX/OSGI container. I've used felix plugin for spring projects like this:

  <plugin>
    <groupId>org.apache.felix</groupId>
    <artifactId>maven-bundle-plugin</artifactId>
    <version>5.1.9</version>
    <extensions>true</extensions>
    <configuration>
      <instructions>
        <Bundle-SymbolicName>
          ${project.groupId}.${project.artifactId}
        </Bundle-SymbolicName>
        <Bundle-Name>${project.artifactId}</Bundle-Name>
        <Bundle-Version>${project.version}</Bundle-Version>
        <Bundle-Activator>
          com.project.SpringBootBundleActivator
        </Bundle-Activator>
        <Export-Package>
          com.project
        </Export-Package>
        <Import-Package>
          com.project
          !org.springframework.*,
          !sun.*,
          !org.apache.tools.*,
          *;resolution:=optional
        </Import-Package>
        <Embed-Dependency>*;scope=compile</Embed-Dependency>
        <Embed-Transitive>true</Embed-Transitive>
      </instructions>
      <buildDirectory>target/deploy</buildDirectory>
    </configuration>
  </plugin>

It's working fine, but I cannot figure it out for non spring classes, cause what it does right now. It's trigger activation class with annotation @SpringBootApplication and allows me to deploy my app inside SMX. What I would like to achieve is, instead of using Spring classes, use some camelContext.xml, that's got and inside and just define some beans from my custom classes inside it. For example, and use method of this class in routes, but when I'm trying installing this classes there is problem with installing bundle inside of the contener. Error is related with OSGI R3 not supported.

0

There are 0 answers