SKM IT World

Just another blog about IT

Generate P2 Repository From Maven Dependencies

1 Comment


Motivation

If you use Maven Tycho to build your Eclipse RCP application, you can use Maven dependencies as you know it from Maven (for more information see [1]). I notice that Tycho takes many times for computing the target platform from the Maven dependencies during the build. I expect a speed up of build time if I use a P2 repository instead of Maven dependencies directly. Therefore, the task is how do I get the Maven dependencies to a P2 repository.

Procedure for generating a P2 repository from Maven dependencies

We generate the P2 repository with the help of some Maven’s plugin and some Maven Tycho’s plugin:

  • Builder Helper Maven Plugin
  • Maven Dependency Plugin
  • Maven Tycho’s P2 Extra Plugin
  • Maven Tycho’s P2 Plugin
  • Maven Tycho’s P2 Repository Plugin

Maven Tycho’s Plugins use Eclipse standard tools internally. How the Eclipse standard tools work are described well on this blog post [2]. Further useful information about Tycho’s plugins can be found in [3] and [4].

We create a POM project and configure plugins mentioned above, so that the following procedure can work:

  1. Define the Maven dependencies, that should be add to the P2 repository, in the <dependencies> section.
  2. Copy these defined dependencies to the source location of the Feature and Bundle Publisher with Maven Dependency Plugin.
  3. Generate P2 repository with P2 Extra Plugin.
  4. Add categories to the P2 metadata with P2 Plugin, so that you can see your P2 repository in Eclipse Target Platform Wizard.
  5. Zip P2 repository with P2 Repository Plugin.
  6. Attach zipped P2 repository to be installed and deployed in the Maven repository during the deploy phase with Builder Helper Plugin.

You can find the whole POM configuration in [5].

How to use zipped P2 Repository from Maven Repository

When you use Nexus as Maven Repository, you can use the Nexus Unzip Plugin ([6]).

Links

[1] Maven Tycho How to – Dependency on pom-first artifacts
[2] Blog Post about Generation P2 Repository with Eclipse Standard Tool
[3] P2 Extra Plugin Project Site
[4] Sonatype Wiki Page about P2 Extra Plugin
[5] POM Project on GitHub
[6] Nexus Unzip Plugin Documentation

Advertisements

One thought on “Generate P2 Repository From Maven Dependencies

  1. This was incredibly helpful! Thank you so much

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s