Reputation: 24411
I am trying to convert and Eclipse plugin project to use Maven. My existing project has the following MANIFEST.MF:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Message Level Security Plugin
Bundle-SymbolicName: com.mls;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: MLS
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Import-Package: com.ghc.ghTester.expressions
Bundle-ClassPath: lib/commons-logging-1.1.1.jar,
lib/log4j-1.2.15.jar,
.
Require-Bundle: org.bouncycastle.crypto;bundle-version="1.46.0",
javax.xml;bundle-version="1.3.4",
org.apache.wss4j;bundle-version="1.5.11",
org.apache.xml.security;bundle-version="1.4.3002",
org.apache.commons.lang;bundle-version="2.6.0"
But I'm having a huge amount of difficulty figuring out how to configure the maven-bundle-plugin
to generate my OSGI bundle properly:
I've tried:
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>3.0.0</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${pom.groupId}.${pom.artifactId}</Bundle-SymbolicName>
<Bundle-Name>${pom.name}</Bundle-Name>
<Bundle-Version>${pom.version}</Bundle-Version>
<Bundle-ClassPath>{maven-dependencies},.</Bundle-ClassPath>
<Embed-Dependency>*;scope=compile|provided</Embed-Dependency>
<Import-Package>com.ghc.ghTester.expressions</Import-Package>
</instructions>
</configuration>
</plugin>
But how do I generate the "Require-Bundle" entry to use the maven dependencies I've listed as "provided"?
Ex:
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
<scope>provided</scope>
</dependency>
Do I have to declare my dependency differently?
Upvotes: 1
Views: 2824
Reputation: 11022
You can explictly add your Require-Bundle
in the pom :
<Require-Bundle>org.bouncycastle.crypto;bundle-version="1.46.0", ...</Require-Bundle>
However, Require-Bundle
is a bad (old?) practice. bndtools, behind the maven-bundle-plugin
can generate for you the right Import-Package
. You shouldn't use the Require-Bundle
header anymore.
Moreover :
<Export-Package/>
tag : by default, this plugin export all packages but *.internal.*
*.impl.*
. If your package doesn't use this convention, you risk to export internal classes of your bundle.Upvotes: 2