Java Reference
In-Depth Information
->
obr-repo add-url file:/Users/foo/.m2/repository/repository.xml
->
obr-repo list
->
obr-resolver deploy ...
You can even use it to remove stale bundle entries from your local OBR:
$
mvn bundle:clean
But how about non-local
OBR
s, like the one listing official Apache Felix bundle
releases at
http://felix.apache.org/obr/releases.xml
? You can configure the maven-
bundle-plugin to automatically update a remote
OBR
whenever it deploys a bundle to
a remote Maven repository, but this isn't enabled by default. For more details about
enabling and configuring remote
OBR
updates, see the plugin documentation on the
Apache Felix website.
A.2.5
Bundling non-JAR projects
What if you don't want to change your project packaging type to
bundle
? Can you still
get Maven to generate
OSG
i metadata for you? You'll be pleased to hear that the
answer is, yes—the maven-bundle-plugin provides a
manifest
goal that you can use to
generate the
OSG
i manifest during other types of builds. To allow the use of this goal
with other packaging types, you first need to tell the maven-bundle-plugin to process
them, like so:
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<supportedProjectTypes>war,ear,jar,zip</supportedProjectTypes>
</configuration>
Next, add an plugin execution to generate the manifest as part of the build lifecycle:
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
Finally, you need to get Maven to include the generated manifest in the final artifact.
Exactly how this happens depends on the packaging you're using, but most archives
support some way to use an existing manifest file.
You've now built bundles using Ant and Maven. What about other build tools and
IDE
s?
A.3
For your consideration
Bnd and the maven-bundle-plugin aren't the only option when developing
OSG
i bun-
dles. As you saw back in chapter 7, Eclipse includes support for developing bundles cour-
tesy of its Plug-in Development Environment (
PDE
). NetBeans and
IDEA
also provide