Packaging and deployment of OSGI bundles on Fuse Karaf standalone
3 plugins are used:
-
features-maven-plugin
Use the 'generate-features-xml' goal tp create a features.xml file based on the pom dependencies and bundles.properties -
build-helper
Attach the features.xml file to the compiled artifact -
features-maven-plugin
Use the 'create-kar' goal tp create a kar file (karaf jar) containing the current bundle + the features.xml
The package can be deployed to Nexus and then used in another project as a feature dependency with:
<dependency>
<groupId>appNamespace</groupId>
<artifactId>appName</artifactId>
<version>x.y.z<version>
<classifier>features</classifier>
<type>xml</type>
</dependency>
The deployed features.xml repository can be added in Karaf with:
features:add-url mvn:appNamespace/appName/x.y.z/xml/features
Then any of the feature or bundle listed in the feature repository can be deployed separately:
features:install ...
The 'generate-features-xml' goal creates a features.xml based on the maven dependencies only and doesn't include the current bundle itself.
The idea is to maintain one single maven project to deploy any artifacts using features.
For that purpose, a dependency defined with the maven properties "package", "application" and "version" has been introduced in the pom.
To create a features.xml for a specific bundle created as a separate maven project and deployed to Nexus in isolation,
simply override the package, application and version propoerties on the command-line:
mven -Dpackage=... -Dapplication=... -Dversion=... deploy