Getting the benefits of maven-bundle-plugin in other project types

Skip to end of metadata
Go to start of metadata

Note: This information is partially available at http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html

The goal here is to be able to use a different packaging type than "bundle", say "war" packaging, and still get benefits of the maven-bundle-plugin. The major benefit is of course having the manifest being generated by the BND tool.

If your project is packaged as "war", you can still use the maven-bundle-plugin to generate the manifest if you add "war" to supportedProjectTypes:

Here is a more complete configuration that I use for generating a manifest using BND and adding it to the WAR:

Now we can get a bundle with a BND-generated manifest installed in the repo as a .war.

For JAR packaging, you'd replace appropriate parts of above with:

Embedding Dependencies

If you use at least maven-bundle-plugin version 1.4.3, it should apply the Embed-Dependency
instruction for both the bundle and manifest goals - however, because the manifest goal doesn't
actually end up building the final bundle then you might find some minor differences.

But you can definitely use this to generate the Bundle-ClassPath even with "war" packaging.

You can configure Embed-Dependency to match the location the WAR plugin uses.

For example perhaps something like:

Example

Hendy Irawan has created a project to demonstrate:

  • Apache CXF
  • OSGi
  • Pax Web Service
  • Pax Web Extender War
  • Maven
  • Maven Bundle Plugin
  • configuring it for WAR project
  • Maven Pax Plugin

Checkout from here: (Subversion)

https://scm.ops4j.org/repos/ops4j/laboratory/users/ceefour/cxf-osgi-sample

This might be helpful with regards to the above, or how to mix and match the combinations.

Note that this is not an official sample, just a contribution.

Labels:
maven2 maven2 Delete
manifest manifest Delete
jar jar Delete
article article Delete
maven-bundle-plugin maven-bundle-plugin Delete
osgi osgi Delete
maven maven Delete
war war Delete
pax pax Delete
bundle bundle Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.

Clicky Web Analytics