This bundle will be called com.packtpub.felix.bookshelf-inventory-impl-mock
. We won't see the whole POM here, but only the parts that are different from the one we saw previously. As we go through the book, I'll start hinting for those contents instead of showing them.
The identity section of the POM for this bundle will look like the following:
<groupId>com.packtpub.felix</groupId> <artifactId> com.packtpub.felix.bookshelf-inventory-impl-mock </artifactId> <version>1.5.0</version> <packaging>bundle</packaging> <name>Bookshelf Inventory Impl - Mock</name> <description> Memory-based mock implementation of the Bookshelf Inventory API </description>
This bundle depends on the inventory API bundle. This dependency is declared as:
<dependencies> <dependency> <groupId>com.packtpub.felix</groupId> <artifactId> com.packtpub.felix.bookshelf-inventory-api</artifactId> <version>1.5.0</version> </dependency> </dependencies>
A dependency is declared by specifying the groupId, artifactId
, and version
of the target library.
The other part that needs to be looked at is the Export-Package
header in the instructions section of the maven-bundle-plugin
configuration.
This bundle exports com.packtpub.felix.bookshelf.inventory.impl.mock:
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.1.0</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-Category>sample</Bundle-Category>
<Bundle-SymbolicName>${artifactId}
</Bundle-SymbolicName>
<Export-Package>
com.packtpub.felix.bookshelf.inventory.impl.mock
</Export-Package>
</instructions>
<remoteOBR>repo-rel</remoteOBR>
<prefixUrl>
file:///C:/projects/felixbook/releases</prefixUrl>
<ignoreLock>true</ignoreLock>
</configuration>
</plugin>
Project inheritance
As you can see, we're repeating a lot of the POM configuration for each project. In Maven, there's a possibility of declaring a parent POM that contains the common configuration and inherits it in its children, thus tremendously reducing the size of each project's POM, but also making it easier to update a configuration centrally and have it applied to all projects.
Consider taking a look at it, under project inheritance, in the Maven POM online documentation.
That's all! Let's get right to the implementation of those interfaces.