Java Reference
In-Depth Information
uniquely identified by their symbolic names and versions. Maven's bundle plug-in
combines
module-level
(or bundle-level) dependencies declared in the pom.xml with
bnd bytecode analysis to produce
OSG
i manifests that declare package-level depen-
dencies. The convenient thing about this process is that it involves almost no extra
work compared to normal Maven
JAR
packaging.
Let's see what the pom.xml file looks like for a simple bundle with no external
dependencies,
fancyfoods.api
, in this listing.
Listing 8.2
The pom.xml build file for the
fancyfoods.api
bundle
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>fancyfoods</groupId>
<artifactId>fancyfoods.api</artifactId>
<packaging>bundle</packaging>
<version>1.0.0</version>
<name>Fancy Foods API</name>
The critical bit that
enables bundle plug-in
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.2.0</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>
${pom.artifactId}
</Bundle-SymbolicName>
<Bundle-Name>
${pom.name}
</Bundle-Name>
<Bundle-Version>
${pom.version}
</Bundle-Version>
<Export-Package>
fancyfoods.food,
fancyfoods.offers
</Export-Package>
</instructions>
</configuration>
</plugin>
</plugins>
B
Configure what
goes in generated
manifest
Versions from
package-info files
API bundle has no
dependencies
</build>
</project>
The manifest generation is controlled by the plug-in configuration for the bundle
plug-in
B
. We've kept all the plug-in configuration in the same file for clarity, but it's














