Tool for managing/hosting own p2 repositories?
Asked Answered
T

2

40

Our company uses Maven. We use the Nexus repository manager in order to store our snapshots and releases.

Currently, we are developing a product based on Eclipse. We use Tycho to do that.

The problem is the following: In our Eclipse-based product we have many features. Our idea is build each feature (or group of features) separately and put them in internal p2 repositories. When one features requires another feature, we point the target platform to necessary internal p2 repository.

Currently, we build application with Tycho. We make our features "deployable", so Tycho produces a P2 site in target. We push that P2 site to our server and then run Eclipse FeaturesAndBundlesPublisher, which merges that recently-built feature with a P2 repository. As a result, we have a internal P2 repository having all the versions of required feature.

We find that this process is too cumbersome. Is there a tool like Nexus, which would be more convenient?

UPD.:There is a discussion on Tycho Users list

Tampon answered 3/12, 2010 at 11:13 Comment(3)
Nexus Pro offers some P2 repository features. Have you looked at whether it would meet your needs?Lucilucia
It is no longer a Nexus Pro-only feature; since Nexus 2.x the p2 plugin is now open source and free for all to use infoq.com/news/2012/02/nexus-20 and github.com/sonatype/nexus-p2-repository-pluginLipoid
The discussion on the tycho list you linked is very old. Nexus with the p2 repo should be able to help you. If there are problems with that ask on the nexus users mailing list or here and we will try to help.Bacteria
B
9

With the Unzip Repository Nexus Plugin, you can use Nexus for exchanging binary artifacts between Tycho builds.

  • Tycho project A publishes its artifacts like a normal Maven project: The project is built with mvn clean deploy, which uploads the project's artifacts into your deploy Maven repository on the Nexus. The only special requirement is that the project builds a p2 repository. The recommended way to do this is an eclipse-repository module, but a "deployable feature" should also work in most cases.

  • On your Nexus, you only need the following one-time configuration: For the deploy Maven repository (or a "Repository Group" which includes that repository), you need to add a virtual repository of type "Unzip Repository". This virtual repository shows zip artifacts from the deploy repository in unpacked form.

    Example: If the p2 repository zip of project A is in the deploy Maven repository at http://nexus.corp/nexus/repositories/build.milestones/corp/example/project-a/project-a-repo/1.0.0/project-a-repo-1.0.0.zip, it will be available in standard p2 repository format in the Unzip Repository at http://nexus.corp/nexus/repositories/build.milestones.unzip/corp/example/project-a/project-a-repo/1.0.0/project-a-repo-1.0.0.zip-unzip/.

  • Tycho project B can reference the artifacts from project A by adding the latter URL to its target platform, e.g. in a target definition file.

In the above example, project B references a release version of project A. The same approach also works for snapshots because the Unzip Repository has support for "symbolic" versions, like 1.1.0-SNAPSHOT for the last deployed 1.1.0-SNAPSHOT or even just SNAPSHOT for the overall highest version. Using these symbolic versions, Project B can then, for example in its own CI build, reference the CI build results project A by adding the resulting (stable!) p2 repository URLs in its target platform.

Disclaimer: The Unzip Repository Nexus Plugin is part of the Tycho project, of which I'm a committer.

Bipropellant answered 13/11, 2012 at 17:16 Comment(4)
Hey oberlies, could you explain the last passage with the "symbolic" version in more detail? Because i need always to speficiy the exactly URI in the *.target-definition like "../p2.repository/1.0.0-SNAPSHOT/p2.repository-1.0.0-20130124.123220-3.zip-unzip/" with the qualifier. What i need is to give the *.target a URI like "../p2.repository/1.0.0-SNAPSHOT/p2.repository-1.0.0-SNAPSHOT.zip-unzip/" to get always the newest version. And the same problem ist in the *.target-file with the units-elements. Your example above have no RELEASE or SNAPSHOT (no qualifier). How to do this?Acanthoid
The unzip repository supports URLs of the form .../p2.repository/1.0.0-SNAPSHOT/p2.repository-1.0.0-SNAPSHOT.zip-unzip/ (unlike normal Maven repositories). Together with <unit id="..." version="0.0.0"/> in target files, you can set up a reference to the latest version of a SNAPSHOT version.Bipropellant
Thanks for your response. That's exactly what i tried to define in the *.target but tycho says: ".TargetDefinitionResolutionException: Failed to load metadata repository from location: ../p2.repository/1.0.0-SNAPSHOT/p2.repository-1.0.0-SNAPSHOT.zip-unzip/" Any special setting required? Should this work also in the webbrowser?Acanthoid
Yes, these URLs should also work in the browser. Make sure to configure useVirtualVersion=true on the Nexus plug-in (see here for details)Bipropellant
I
3

Maybe this is a bit late, but I am currently working on an open source (EPL) repository manager which supports the workflow of deploying to a repository with maven and tycho, and consuming it as P2 repository.

It is also possible to deploy bundles created by maven (not maven tycho) and the P2 metadata will be generated automatically.

The project is called "Package Drone" and hosted on github. There is also a short introduction video.

Irina answered 30/12, 2014 at 14:20 Comment(1)
Thanks for the response. It was a while ago. Let's see what other people say!Tampon

© 2022 - 2024 — McMap. All rights reserved.