Generate P2 Repository From Maven Artifacts In 2017
A new version of this blog post is published under the title "Generate P2 Repository From Maven Artifacts in 2017"
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 ). 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 . Further useful information about Tycho's plugins can be found in  and . We create a POM project and configure plugins mentioned above, so that the following procedure can work:
- Define the Maven dependencies, that should be add to the P2 repository, in the
- Copy these defined dependencies to the source location of the Feature and Bundle Publisher with Maven Dependency Plugin.
- Generate P2 repository with P2 Extra Plugin.
- Add categories to the P2 metadata with P2 Plugin, so that you can see your P2 repository in Eclipse Target Platform Wizard.
- Zip P2 repository with P2 Repository Plugin.
- 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 .
How to use zipped P2 Repository from Maven Repository
When you use Nexus as Maven Repository, you can use the Nexus Unzip Plugin ().