Reputation: 7810
I started creating an OSGI bundle. So It works fine. But when I put output directory in configuration section in maven bundle plugin, it won't add any of compiled classes. simply say, the classpath is empty.I am also using maven compiler plugin. Are they conflicting each other? Is there anything which I configured in a wrong way. This is the build section of my pox.xml file.
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>1.4.0</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Name>${project.artifactId}</Bundle-Name>
<Export-Package>
demo.wso2.orderprocess.*
</Export-Package>
</instructions>
<outputDirectory>/home/wso2/product/wso2esb-4.9.0/repository/components/dropins</outputDirectory>
</configuration>
</plugin>
</plugins>
Upvotes: 1
Views: 1707
Reputation: 198
You should use <buildDirectory>/home/wso2/product/wso2esb-4.9.0/repository/components/dropins</buildDirectory>
instead of <outputDirectory>/home/wso2/product/wso2esb-4.9.0/repository/components/dropins</outputDirectory>
. It did the trick for me, so now I can increase the speed of the OSGI bundles development!
Reference: Maven Bundle Plugin documentation
Upvotes: 3
Reputation: 31
Here is what I did to get around the issue and it worked!!!
Keep your project packaging type as "jar" and add OSGI metadata to it. This can be achieved by adding an execution goal to the maven-bundle-plugin and referencing it from maven-jar-plugin. Now, just add the outputDirectory path into the maven-jar-plugin where you want to place the jar.
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
<outputDirectory>/path/to/output/directory</outputDirectory>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<executions>
<execution>
<id>bundle-manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
</plugin>
Now, to build the project, run the following command. This will generate the manifest file and package it into jar.
mvn org.apache.felix:maven-bundle-plugin:manifest install
Reference:
Upvotes: 3