Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3
dashed
Panel
borderColor#ccc
bgColor#ffff99
titleBGColor#F7D6C1
titleMerging Banner Warning
borderStyle
Warning

The maven-obr-plugin is going to be merge into maven-bundle-plugin. The merging is scheduled for the version deprecated and its features have been merged into the 1.4.0 release of the maven-bundle-plugin

This Maven plug-in aims to automate OBR (OSGi Bundle Repository) management. It helps manage a local OBR for your local Maven repository, and also supports remote OBRs for bundle distribution. The plug-in automatically computes bundle capabilities and requirements, using a combination of Bindex and Maven metadata.

Features

The maven-obr-plugin supports:

  • Management of both local and remote OBRs
  • Registering Maven and non-Maven artifacts with OBRs
  • Automatically discovering bundle capabilities and requirements
  • Customizing bundle descriptions

How to use the maven-obr-plugin?

The plug-in offers five Maven goals:

...

Any of these goals can be disabled by setting -DobrRepository=NONE

obr:install

The install goal updates the local OBR with the details of the installed bundle from the local Maven repository.

...

Code Block
xml
xml
<plugin>
  <groupId>org.apache.felix</groupId>
  <artifactId>maven-obr-plugin</artifactId>
  <version>1.2.0</version>
  <executions>
    <execution>
      <goals>
        <goal>install</goal>
      </goals>
    </execution>
  </executions>
</plugin>

obr:install-file

The install-file goal updates the local OBR with the details of a bundle from the local filesystem.

...

No Format
mvn org.apache.felix:maven-obr-plugin:1.2.0:install-file \
  -DpomFile=myPom.xml -Dfile=foo-1.0.jar

obr:deploy

The deploy goal updates the remote OBR with the details of the deployed bundle from the local Maven repository. The remote OBR is found by querying the <distributionManagement> section of the project, unless -DaltDeploymentRepository is set. See http://maven.apache.org/plugins/maven-deploy-plugin/deploy-mojo.html for more details about these particular settings.

...

Code Block
xml
xml
<plugin>
  <groupId>org.apache.felix</groupId>
  <artifactId>maven-obr-plugin</artifactId>
  <version>1.2.0</version>
  <executions>
    <execution>
      <goals>
        <goal>deploy</goal>
      </goals>
    </execution>
  </executions>
</plugin>

obr:deploy-file

The deploy-file goal updates the remote OBR with the details of a deployed bundle from the local filesystem. The remote OBR is found using the -DrepositoryId and -Durl parameters. See http://maven.apache.org/plugins/maven-deploy-plugin/deploy-file-mojo.html for more details about these particular settings.

...

No Format
mvn org.apache.felix:maven-obr-plugin:1.2.0:deploy-file \
  -DpomFile=myPom.xml -Dfile=foo-1.0.jar -Durl=file:/tmp/example/OBR \
  -DbundleUrl=http://www.foo.org/bundles/foo.jar

obr:clean

Sometimes you would like to clean your local OBR because it contains bundles that are no longer in your local Maven repository. This case often occurs when artifacts were deleted manually. The maven-obr-plugin provides a simple goal to check for missing bundles, and remove them from the local OBR.

...

Code Block
xml
xml
<plugin>
  <groupId>org.apache.felix</groupId>
  <artifactId>maven-obr-plugin</artifactId>
  <version>1.2.0</version>
  <executions>
    <execution>
      <goals>
        <goal>clean</goal>
      </goals>
    </execution>
  </executions>
</plugin>

Concurrent updates

With a remote OBR, several uploads may occur at the same time. However, the remote OBR is centralized in one file, so concurrent modification must be avoided. To achieve this, the plug-in implements a locking system. Each time the plug-in tries to modify the file it sets a file based lock. If it can't take the lock, it will wait and retry. After 3 attempts the upload process fails. To bypass this lock add -DignoreLock to the command-line (or add <ignoreLock>true<ignoreLock> to the configuration section of your Pom).

FTP protocol

Not all protocols are supported by Maven out of the box. For example the ftp protocol requires the wagon-ftp component. To enable the ftp protocol add this to your Pom:

Code Block
xml
xml
<build>
  <extensions>
    <extension>
      <groupId>org.apache.maven.wagon</groupId>
      <artifactId>wagon-ftp</artifactId>
      <version>1.0-alpha-6</version>
    </extension>
  </extensions>
</build>

How the plug-in computes the description of the bundle

The description of the bundle comes from three different sources:

...

A warning message is displayed when existing information is overridden.

Known issues & limitations

  1. obr.xml (file given by the user to add properties not found by Bindex) must be correct, because the plug-in does not check its syntax.