4

I am using servicemix(v4.5.3) and want to deploy my application(depends upon hundreds of third party library) as bundle via maven-bundle-plugin.

Below is my pom.xml

<plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>2.3.7</version>
                <extensions>true</extensions>
                <executions>
                       <execution>
                            <id>wrap-my-dependency</id>
                            <goals>
                                <goal>wrap</goal>
                            </goals>
                            <configuration>
                                 <wrapImportPackage></wrapImportPackage>
                                 <instructions>

                                        <Include-Resource>{maven-resources}</Include-Resource>
                                        <Bundle-ClassPath>.</Bundle-ClassPath>
                                        <Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
                                        <Embed-Transitive>true</Embed-Transitive> 
                                        <Import-Package>*</Import-Package>
                                        <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
                                        <Bundle-Name>${project.artifactId}</Bundle-Name>
                                        <Bundle-Version>1.0.0</Bundle-Version>
                                        <Bundle-Activator>com.bundle.example.Main</Bundle-Activator>

                                </instructions>
                             </configuration>
                      </execution>
                </executions>

            </plugin>

I've followed this for creating bundle, but when I execute mvn bundle:wrap than it convert the external jars into bundle and placed into target/classes folder of my project.

Now, my query is should I have to copy all bundle and placed into deploy folder of servicemix installation directory to run my application. I've followed this approach, but still I am getting some error in while my application starts.

Manifest file :

    Imported Packages

    com.dhtmlx.connector from dhtmlxgridConnector (476)
    com.google.gson,version=[1.7,2) -- Cannot be resolved
    com.googlecode.ehcache.annotations,version=[1.1,2) -- Cannot be resolved
    com.hazelcast.core,version=[2.6,3) from com.hazelcast (437)
    com.tinkerpop.blueprints -- Cannot be resolved
    com.tinkerpop.blueprints.impls.orient -- Cannot be resolved
    com.tinkerpop.frames -- Cannot be resolved

This is just a little part of my Manifest file of bundle. Here some bundle are still unresolved that I think the problem for starting my bundle.

And 2nd query: is there any better approach to handle all 3rd parties libraries while using maven-bundle-plugin. waiting for some valuable suggestion.

рüффп
  • 4,475
  • 34
  • 62
  • 99
ved
  • 869
  • 2
  • 16
  • 42

1 Answers1

0

When I need to convert a JAR to a bundle in Servicemix and import I use:

./bin/servicemix

osgi:install -s wrap:file:////"jar_location Ex: /lib/ojdbc6-13.jar"

Execute shutdown command, choose yes option.

Now your JAR will be available as a bundle in ServiceMix.

Kevin Martins
  • 509
  • 4
  • 16