I'd like to build osgi components and I have been told to use maven-bundle-plugin
. I started off by adding this into my pom.xml
:
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>3.0.0</version>
<extensions>true</extensions>
<configuration>
<obrRepository>NONE</obrRepository>
<instructions>
<_include>-bnd.bnd</_include>
</instructions>
</configuration>
</plugin>
Notice the .bnd
file which is passed to <_include>
tag. I've heard people saying that these files should be kept at minimum, or even empty, and then should be observed what imports/exports are needed, etc. This is where I get confused. I have my MANIFEST.MF
file, in which I know what to import and export. However, I need a bit of help to make my .bnd
files working. Right now I am trying with empty .bnd
files and I am not sure if it is working as it should be.
Does anyone have any experience with this plugin and the way I want to make it work?
For instance, here is a sample .bnd
file. However I don't know how he decided that these should imports/exports be there.
As of now, when I try to test the .jar
I get
no main manifest attribute, in bundle-1.0.0.jar
error despite of the fact that there is indeed MANIFEST.MF
in the .jar
.
Update: I thought I could share the MANIFEST.MF
that I had previously, which I want to generate via this plugin now.
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Just a Name
Bundle-SymbolicName: just.a.name.broker;singleton:=true
Bundle-Version: 1.0.0
Require-Bundle: org.apache.activemq,
just.msg
Bundle-Activator: just.a.broker.Activator
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Import-Package: javax.naming,
javax.xml,
javax.xml.parsers,
org.apache.log4j.xml,
org.osgi.framework
Bundle-ClassPath: .
Export-Package: just.a.broker
So in order to have such a manifest, how should my .bnd
file look like? Or is it better to include the properties in the plugin rather than passing the .bnd
file?