OPS4J
  Scanner - Maven 2 POM
Added by Alin Dreghiciu, last edited by Alin Dreghiciu on Jan 12, 2008  (view change)

Labels

 

Overview

The pom scanner installs and optionaly starts a set of bundles listed in maven 2 pom file. The set of bundles to be installed is composed out of main artifact of the project (if not an pom) and all dependencies of type jar (= default type in maven) or bundle that do not have a scope of "test".

Syntax

scan-pom:pom_xml_url[@start_level][@nostart][@update]

where:

  • pom_xml_url : mandatory; is the url of the pom;
  • start_level : optional; an integer representing the start level of the bundles present in the pom.
    If present and OSGi Start Level Service is available then the bundle is installed with that specific start level.
    This option overwrites the startLevel configuration property;
  • nostart : optional; this should be the hardcoded string "nostart" (not case sensitive).
    If present the bundles will not be started.
    This option overwrites the start configuration property;
  • update : optional; the hardcoded string "update" (not case sensitive)
    If present the bundles will be updated.
    This option overwrites the update configuration property;

Examples

  • scan-pom:mvn:org.ops4j.pax.web.bundles/service/LATEST/pom - installs the latest pax web service.
  • scan-pom:file:/C:/my-project/pom.xml - installs the bundles contained in the pom of my-project located on local drive.
  • scan-pom:zip:file:/C:/bundles.zip!/pom.xml - installs the bundles contained the specified pom.xml from a distribution zip file located on the local drive.

File Format

The pom file must comply to the maven project object model specification.

If the pom file contains properties those will be carried into the OSGi platform. The value can contain place holders as ${name} where name is the name of the property the ${name} placeholder will be replaced with.
For instance, if you are deploying an OSGi HTTPService (as the example above is doing) you might want to set the port of the Http listener. You do that in the application POM like this:

<project>
  ...
  <properties>
    <org.osgi.service.http.port>2080</org.osgi.service.http.port>
    <org.osgi.service.http.port.secure>2443</org.osgi.service.http.port.secure>
  </properties>
  ...
</project>
File Examples

Any valid maven pom.

Configuration

The service can be configured in two ways: via configuration admin if available and via framework/system properties where the configuration via config admin has priority.

Option key Description
org.ops4j.pax.runner.scanner.pom.startlevel optional; default start level.
org.ops4j.pax.runner.scanner.pom.start optional; true/false - if installed bundles should be started ot not. Default value is true, so the bundles are started.
org.ops4j.pax.runner.scanner.pom.update optional; true/false - if installed bundles should be updated or not. Default value is false, so the bundles will not be updated.

Installation guide

This bundle is part of Pax Runner so if you are using pax runner you have nothing more to do about.
If you wanna use the bundle as a standalone bundle you could install it using the following methods:

Manual installation
Pax Runner installation

pax-run mvn:org.ops4j.pax.runner/pax-runner-scanner-pom

Source code

https://scm.ops4j.org/repos/ops4j/projects/pax/runner/pax-runner-scanner-pom ( or browse via FishEye )
This project builds with Apache Maven and uses Apache Felix's maven-bundle-plugin, and Peter Krien's bnd tool.

Future

Handle transitive dependencies.

See also

Pax URL - classpath — classpath: protocol handler. Provides access to classpath resources from your bundle or other bundles installed.
Pax URL - ivy — ivy: protocol handler. Provides access to Ivy artifacts. (not implemented yet)
Pax URL - mvn — mvn: protocol handler. Provide access to maven repository artifacts based on the well known groupId, artifactId, version and type
PAX URL - obr — obr: protocol handler. Make use of OBR bundle repository.
Pax URL - war — war:/war-i: protocol handlers. Automates war deployment.
Pax URL - wrap — wrap: protocol handler. Wraps "classic" jars as OSGi bundles.
Platform - Concierge — Starts up Concierge OSGi framework
Platform - Equinox — Starts up Equinox OSGI framework
Platform - Extender — Installs platform services based via a whiteboard pattern
Platform - Felix — Starts up Felix OSGi framework
Platform - Knopflerfish — Starts up Knopflerfish OSGi framework
Scanner - Bundle — Installs a bundle specified as url.
Scanner - Directory — Install bundles available in a file system directory or zip
Scanner - File — Install bundles listed in a plain text file
Scanner - Maven 2 POM — Installs bundles listed as dependencies in a maven 2 pom.xml file
Scanner - OBR — Resolves and installs bundles references listed in a plain text file