Java Reference
In-Depth Information
to
<packaging>bundle</packaging>
You can now ask Maven to rebuild your project:
$ mvn clean install
If you compare the console output to the previous build, you should see that it uses
the maven-bundle-plugin to package the project. The JAR manifest now contains the
appropriate OSG i headers:
Manifest-Version: 1.0
Export-Package: examples.osgi
Bundle-Version: 1.0.0.SNAPSHOT
Build-Jdk: 1.6.0_22
Built-By: me
Tool: Bnd-0.0.357
Bnd-LastModified: 1289004026415
Bundle-Name: mybundle
Bundle-ManifestVersion: 2
Created-By: Apache Maven Bundle Plugin
Import-Package: examples.osgi
Bundle-SymbolicName: examples.mybundle
Notice how you didn't need to add anything else to the project—the maven-bundle-
plugin uses existing information (project metadata, resources, and source code) to
generate reasonable defaults for the OSG i manifest. But what are these defaults, and
how can you customize the bundle?
A.2.2
Going undercover
You may have noticed a couple of bnd headers in the last manifest. This is because the
maven-bundle-plugin leans on the bnd tool to do the heavy work of assembling the bun-
dle and generating the manifest. In other words, the main task of the maven-bundle-
plugin is to translate Maven metadata into bnd instructions, so developers don't have
to repeat themselves over and over again. The default translations are listed in table A.1.
Table A.1
maven-bundle-plugin defaults
OSGi header
Maven metadata
Bundle-Name
${project.name}
Bundle-SymbolicName ${project.groupId}.${project.artifactId} with
duplicate segments removed
Bundle-Version
${project.version} normalized to the OSGi format
Bundle-Description
${project.description}
Bundle-License
${project.licenses}
Bundle-DocURL
${project.organization.url}
 
Search WWH ::




Custom Search