Target platform provisioning tools for p2 repositories
An Apache Maven plugin for creating p2 repositories along with features directly from Maven artifacts. This provides easy use of those artifacts during development of Eclipse RCP applications within the Eclipse IDE.
This project was created when I wanted to use Jersey inside an Eclipse RCP application and found it incredibly inconvenient to transform it's Maven artifacts into a p2 repository directly usable from Eclipse with the various existing tools.
Features
-
Create a p2 repository based on Maven's project dependency
-
Supports dependency from the same reactor or repositories
-
Detects source artifacts and transforms them into Eclipse source bundles
-
Converts dependencies to OSGi bundles using bnd on the fly
-
Creates a feature with all dependencies
-
Creates a category for easier use in Eclipse's .target editor
-
-
Deploy p2 repositories to a file system structure that can be read by eclipse or exposed via http using a webserver
-
Compare created repositories to results from a previous Maven build and discard the changes if the two repositories are considered equal
-
Ignores changes if only the version numbers or the build qualifier is really changed
-
Allows subsequent Maven builds to produce a binary identical result
-
-
Create composite p2 repositories from multiple "normal" p2 repositories in the same reactor
-
Add mirrored artifacts from other p2 repositories
- Uses a transparent HTTP-level cache that will avoid downloading the same artifacts multiple times
- Automatically mirrors source bundles / features if they follow the usual naming conventions
- Tycho's mirror goal can be used as well
Usage
To create a P2 repository from a Maven artifact that is already an OSGi bundle is as simple as:
<groupId>com.github.pms1.tppt</groupId>
<artifactId>mavenrepo-bundle-dependency</artifactId>
<version>0.0.0-SNAPSHOT</version>
<packaging>tppt-repository</packaging>
<dependencies>
<dependency>
<groupId>net.sf.jopt-simple</groupId>
<artifactId>jopt-simple</artifactId>
<version>5.0.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.github.pms1.tppt</groupId>
<artifactId>tppt-maven-plugin</artifactId>
<version>0.1.0</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
This will create the following p2 repository:
artifacts.jar
content.jar
features/
features/com.github.pms1.tppt.mavenrepo-bundle-dependency_0.0.0.100.jar
p2.index
plugins/
plugins/net.sf.jopt-simple.jopt-simple.source_5.0.1.jar
plugins/net.sf.jopt-simple.jopt-simple_5.0.1.jar
Deploying
The tppt:deploy
goal can be used to deploy the create p2 repository to an external resource. The following resources are supported:
- Filesystem
- HTTP(S) server with WebDAV support (version 0.4.0 or above)
The target must be specified in the form <serverId>::<uri>
either as deploymentTarget
in the configuration
section of the pom.xml
or as a command line property tppt.deploymentTarget
. For file
URIs the server id is ignored, for http
or https
it is used to lookup authentication credentials in the maven settings.
For HTTP(S) the following restrictions apply:
- Only HTTP basic auth with preemptive authentication is supported
- Different WebDAV servers behave very different in a lot of details. It was only tested with artifactory and Apache HTTPD with mod_dav. As these 2 already are different in 3 details, it is not expected that other servers will work out of the box.
At the root of the deployment target a P2 composite repository is created that contains a list of all repositories deployed by tppt. This is used to (significantly for HTTP) speed up finding baseline repositories.