The Object Teams Blog

Adding team spirit to your objects.

Eclipse Neon.2 is on Maven Central

with 7 comments

It’s done, finally!

Bidding farewell to my pet peeve

In my job at GK Software I have the pleasure of developing technology based on Eclipse. But those colleagues consuming my technology work on software that has no direct connection to Eclipse nor OSGi. Their build technology of choice is Maven (without tycho that is). So whenever their build touches my technology we are facing a “challenge”. It doesn’t make a big difference if they are just invoking a code generator built using Xtext etc or whether some Eclipse technology should actually be included in their application runtime.

Among many troubles, I recall one situation that really opened my eyes: one particular build had been running successfully for some time, until one day it was fubar. One Eclipse artifact could no longer be resolved. Followed long nights of searching why that artifact may have disappeared, but we reassured ourselves, nothing had disappeared. Quite to the contrary somewhere on the wide internet (Maven Central to be precise) a new artifact had appeared. So what? Well, that artifact was the same that we also had on our internal servers. Well, if it’s the same, what’s the buzz? It turned out it had a one-char difference in its version: instead of 1.2.3.v20140815 its version was 1.2.3-v20140815. Yes take a close look, there is a difference. Bottom line, with both almost-identical versions available, Maven couldn’t figure out what to do, maybe each was considered as worse than the other, to the effect that Maven simply failed to use either. Go figure.

More stories like this and I realized that relying on Eclipse artifacts in Maven builds was always at the mercy of some volunteers, who typically don’t have a long-term relationship to Eclipse, who filled in a major gap by uploading individual Eclipse artifacts to Maven Central (thanks to you volunteers, please don’t take it personally: I’m happy that your work is no longer needed). Anybody who has ever studied the differences between Maven and OSGi (wrt dependencies and building that is) will immediately see that there are many possible ways to represent Eclipse artifacts (OSGi bundles) in a Maven pom. The resulting “diversity” was one of my pet peeves in my job.

At this point I decided to be the next volunteer who would screw up other people’s builds who would collaborate with the powers that be at Eclipse.org to produce the official uploads to Maven Central.

As of today, I can report that this dream has become reality, all relevant artifacts of Neon.2 that are produced by the Eclipse Project, are now “officially” available from Maven Central.

Bridging between universes

I should like to report some details of how our artifacts are mapped into the Maven world:

The main tool in this endeavour is the CBI aggregator, a model based tool for transforming p2 repositories in various ways. One of its capabilities is to create a Maven repository (a dual use repo actually, but the p2 side of this is immaterial to this story). That tool does a great job of extracting meta data from the p2 repo in order to create “meaningful” pom files, the key feature being: it copies all dependency information, which is originally authored in MANIFEST.MF, into corresponding declarations in the pom file.

Still a few things had to be settled, either by improving the tool, by fine tuning the input to the tool, or by some steps of post-processing the resulting Maven repo.

  • Group IDs
    While OSGi artifacts only have a single qualified Bundle-SymbolicName, Maven requires a two-part name: groupId x artifactId. It was easy to agree on using the full symbolic name for the artifactId, but what should the groups be? We settled on these three groups for the Eclipse Project:

    • org.eclipse.platform
    • org.eclipse.jdt
    • org.eclipse.pde
  • Version numbers
    In Maven land, release versions have three segments, in OSGi we maintain a forth segment (qualifier) also for releases. To play by Maven rules, we decided to use three-part versions for our uploads to Maven Central. This emphasizes the strategy to only publish releases, for which the first three parts of the version are required to be unique.
  • 3rd party dependencies
    All non-Eclipse artifacts that we depend on should be referenced by their proper coordinates in Maven land. By default, the CBI aggregator assigns all artifacts to the synthetic group p2.osgi.bundle, but if s.o. depends on p2.osgi.bundle:org.junit this doesn’t make much sense. In particular, it must be avoided that projects consuming Eclipse artifacts will get the same 3rd party library under two different names (perhaps in different versions?). We identified 16 such libraries, and their proper coordinates.
  • Source artifacts
    Eclipse plug-ins have their source code in corresponding .source plug-ins. Maven has a similar convention, just using a “classifier” instead of appending to the artifact name. In Maven we conform to their convention, so that tools like m2e can correctly pick up the source code from any dependencies.
  • Other meta data
    Followed a hunt for project url, scm coordinates, artifact descriptions and related data. Much of this could be retrieved from our MANIFEST.MF files, some information is currently mapped using a static, manually maintained mapping. Other information like licences and organization are fully static during this process. In the end all was approved by the validation on OSSRH servers.

If you want to browse the resulting wealth, you may start at

Everything with fully qualified artifact names in these groups (and date of 2017-01-07 or newer) should be from the new, “official” upload.

This is just the beginning

The bug on which all this has been booked is Bug 484004: Start publishing Eclipse platform artifacts to Maven central. See the word “Start”?

To follow-up tasks are already on the board:

(1) Migrate all the various scripts, tools, and models to the proper git repo of our releng project. At the end of the day, this process of transformation and upload should become a routine operation to be invoked by our favourite build meisters.

(2) Fix any quirks in the generated pom files. E.g., we already know that the process did not handle fragments in an optimal way. As a result, consuming SWT from the new upload is not straight forward.

Both issues should be handled in or off bug 510072, in the hope, that when we publish Neon.3 the new, “official” Maven coordinates of Eclipse artifacts will be even fit all all real world use. So: please test and report in the bug any problems you might find.

(3) I was careful to say “Eclipse Project”. We don’t yet have the magic wand to apply this to literally all artifacts produced in the Eclipse community. Perhaps s.o. will volunteer to apply the approach to everything from the Simultaneous Release? If we can publish 300+ artifacts, we can also publish 7000+, can’t we? 🙂

happy building!

Written by Stephan Herrmann

January 9, 2017 at 23:21

Posted in Eclipse, Uncategorized

Tagged with , , , ,

7 Responses

Subscribe to comments with RSS.

  1. This is REALLY great news… CONGRATULATION!

    I have played with the CBI Aggregator to do the same thing on a small project: “eclipse mylyn wikitext” and I did not push it to maven central. [1] I had the vision Eclipse needs something like what you did and I definitively try to consume some of the Eclipse artifacts from Maven Central.

    I think we (as eclipse community) need to keep your experiment going and we need to make it part of the release-train procedure for the project who opt-in for that. What are the communication channels to continue the discussion? I guess projects needs to opt-in if they want to use this new approach (the “CBI-to-maven-central” approach) and a group of commiters should volounteer to administrate it (review candidate, help with the configuration, and so on). I have limited maven-central skills but I could imagine to join this group (for example I am already doing some basic administration for the Eclipse Planet)

    I will reference your blog post on Bug 421551 because I think that mylyn wikitext should use your approach to be present on maven central.

    [1] https://github.com/jmini/mylyn-wikitext-repository/

    jmini

    January 10, 2017 at 11:07

  2. Excellent

    Dave

    January 10, 2017 at 12:56

  3. This is really good news. Keep up the good work!

    It always pained me how much good stuff siloed in Eclipse-land that could potentially be used in non-Eclipse and non-OSGi applications but was out of reach, due to code having dependencies on the OSGi and/or Eclipse runtimes, and the mismatch in packaging/distribution stories.

    One thing that happened back in 3.2 was that the extension registry was made independent of the Eclipse runtime. Sadly, that is not often taken advantage of and the approach isn’t followed as a guideline in Eclipse.org projects, though some exceptions exist (EMF).

    By the way, this code shows an Eclipse extension registry being populated in a standalone application. It was written based on work by Eclipse Platform’s Paul Webster.

    https://github.com/abstratt/textuml/blob/master/standalone/com.abstratt.standalone/src/com/abstratt/standalone/StandaloneRegistryLoader.java

    This is an example of how to use it:

    https://github.com/abstratt/textuml/blob/master/standalone/com.abstratt.mdd.frontend.cli.standalone/src/com/abstratt/mdd/frontend/cli/standalone/StandaloneCompilationDirectorCLI.java

    rchaves

    January 10, 2017 at 16:33

  4. […] dem Blog des Object Teams verkündete Stephan Herrmann unlängst, dass nun sämtliche, vom Eclipse-Projekt produzierte […]

  5. […] a nice coincidence that Stephan Herrmann did the same for the Eclipse Platform, JDT and PDE but there are some differences (today) from what I read on his blog entry (don’t shoot me […]

  6. […] Eclipse Neon.2 is on Maven Central […]


Leave a comment