This plugin for Maven 2 is based on the BND tool from Peter Kriens. The way BND works is by treating your project as a big collection of classes (e.g., project code, dependencies, and the class path). The way you create a bundle with BND is to tell it the structure of the bundle's JAR file as a subset of the available classes. This plugin wraps BND to make it work specifically with the Maven 2 project structure and to provide it with reasonable default behavior for Maven 2 projects.
Rather than going straight to a detailed list of plugin features, we will first look at a simple example of how to use the plugin to give an immediate flavor. A detailed "how to" will follow.
Assume that we have a simple bundle project that has a pubic API package an several implementation packages, such as:
org.foo.myproject.api org.foo.myproject.impl1 org.foo.myproject.impl2 ... |
If we also assume that we have a bundle activator in one of the implementation packages, then <plugins> section of the POM file would look like this:
...
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Export-Package>org.foo.myproject.api</Export-Package>
<Private-Package>org.foo.myproject.*</Private-Package>
</instructions>
</configuration>
</plugin>
<plugins>
...
|
The <Export-Package> instruction tells the plugin which of the available packages to include into the bundle and to export, while the <Private-Package> instruction tells the plugin which of the available packages to include into the bundle but not export. If the two sets overlap, as they do in the case, then the export takes precedence.