P2, Maven, and Gradle

If you work with eclipse, then you know all about p2. It’s an ambitious piece of software with broad scope, and it gives the eclipse ecosystem several unique features (bundle pools!). The downside of its ambition and scope is its complexity - it can be daunting for newcomers to use. Based on google search traffic, let’s see how many people are searching the term p2 repository:

It looks like, for now, p2 has reached its full audience. To put the y-axis into perspective, let’s compare the number of people searching for p2 repository with the number of people searching for maven repository.

This tells us two things:

  1. If you publish software in a p2 repository, most of the java world doesn’t know how to get it.
  2. Unless some event happens, that’s not going to change - the trends, such as they exist currently, are not in p2’s favor.

The tragedy of this is that the eclipse ecosystem has lots of valuable bits to offer the broader community, and the broader community has lots of valuable contributions that aren’t happening because they just can’t get our stuff in the first place.

If we were looking for a strategy to get eclipse and p2 into the hands of more users and potential contributors, where could we go?

There are still way more Maven users than Gradle users - the p2 and maven results are reduced by having “repository” on the end. But Gradle is on a monstrous growth trajectory, and it already sees millions of downloads per month.

So, in an attempt to put Eclipse, p2, and its associated ecosystem onto the Gradle rocketship, I’m proud to present Goomph. Goomph is a gradle plugin which can do two things:

  1. Put a little snippet inside your build.gradle file, and it will provision your IDE as a disposable build artifact, using techniques stolen from Oomph.
apply plugin: 'com.diffplug.gradle.oomph.ide'
oomphIde {
	jdt {}
	eclipseIni {
		vmargs('-Xmx2g')    // IDE can have up to 2 gigs of RAM
	style {
		classicTheme()  // oldschool cool
		niceText()      // with nice fonts and visible whitespace
  1. It can download artifacts from a p2 repository, run PDE build, run eclipse ant tasks, and all kinds of eclipse build system miscellany.

If you’re curious about these claims, you can quickly find out more by cloning the Gradle and Eclipse RCP demo project. Run gradlew ide and you’ll have a working IDE with a targetplatform ready to go. Run gradlew assemble.all and you’ll have native launchers for win/mac/linux.

If you’d like to know more about Gradle and p2, here’s a youtube video of a talk I presented at Gradle Summit 2016.

Future blog posts will dive deeper into these topics. If you’d like to be notified, you can follow its development on any of these channels:

I really enjoyed your video Ned and the associated posts. I’ve cloned the “goomph and eclipse rcp” repo and have been messing around with it. I have a pile of manifest first bundles in eclipse, a very specific .target (to include a specialized equinox distro …don’t want to download "latest’ and overwrite), a bunch of feature.xml files, and a few core .product files (“Export Product…” from within eclipse). I also publish the features to multiple p2 repo’s. I really want to move to a gradle based PDE/P2 build for all the reasons you mentioned but I’m not totally sure how to do that with the gradle goomph plugins diffplug released. I’m not looking to gen an IDE here …at least not yet. Just refactor my existing pde artifacts.

My use case is more of “refactor” existing eclipse stuff into a gradle based approach. I have detailed manifests done the eclipse “way”. Do I need to rewrite every manifest using the bnd wrapper provided? How do I map a .product into your plugins? How do I publish a feature.xml into a p2 repo using your plugins? etc.

Any vector you can provide me would be greatly appreciated. Thanks.

Glad it’s helpful to you MCog :slight_smile:

Goomph can do all the things you’re asking, and you won’t have to rewrite your manifests or feature.xml. Goomph is a-la-carte, so if you don’t want it to generate your manifests for you, that’s fine with Goomph.

I try to hangout on Gitter to answer questions live as much as I can, and also feel free to use the GitHub issues as a forum for asking questions.

As a starting point, this part of the GitHub readme indexes features like: