Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tycho-user] Can a p2 repository be setup during the Maven build or must it exist prior to starting the Maven build?

You can host a P2 repository in Nexus OSS through the nexus p2 repository.
If you enable p2 features on a Nexus repository, each time you deploy an OSGI artifact on this Nexus p2, an underlying p2 repository is updated and you can use the remote P2 repository from Tycho. It does not support features but one guy from the community has produced one that supports it.

Regards
Jeff

https://docs.sonatype.org/display/Nexus/Nexus+OSGi+Experimental+Features+-+P2+Repository+Plugin
 

On Fri, Jun 1, 2012 at 8:20 PM, Craig Reichenbach <craigeebach@xxxxxxxxx> wrote:
Hello,

Is it possible to setup a p2 repository on the fly during the Maven build?  It appears there is not and that the p2 repository must be in place before running Maven, which validates p2 repositories immediately after starting.  So the build fails immediately if a p2 repository type is specified in any pom.xml in your project that does not actually exist yet.  Can anyone else confirm?   This is obviously quite different from the way Maven handles dependencies at build time.  More details, and my workaround below.

-Craig

My situation is as follows:

Build A produces an eclipse p2 repository and is deploying it to Nexus as a zip artifact.
Build B is using Tycho to build a set of eclipse plugins that depend on build A's eclipse p2 repository.
We are using Nexus OSS (not Pro).

What is the best way to have build B consume the p2 repository created by build A?  

My solution at this point is to create a Maven "fetcher" project ("pom" packaging type) in build B that unpacks the p2 repository zip artifact from Nexus to a local location using the maven-dependency-plugin's unpack goal.  I had expected to be able to execute this project as part of build B before the eclipse projects were built.  However, build B fails immediately after starting because the first thing that happens, before any project is built, is that the target platforms are evaluated for all Tycho eclipse projects.  In this case the local p2 repository I have defined in one of my pom.xml files does not exist yet since my fetcher project did not yet download & unpack it.  

To overcome this, I run Maven to build only the fetcher project as part of a prebuild step.  Once this completes, Maven is run a second time for the overall build which now works fine since the local repository has been established beforehand.

I would have expected to have had the opportunity to setup my p2 repository as part of a Maven build, but Tycho appears to expect the p2 repository to be in place before the build starts.  This is fine for repos that are static, like eclipse helios or indigo repositories, but is not good for repos that are built in a continuously integrated manner, and shared through a Maven repo like Nexus OSS.  I wonder of Nexus Pro addresses this by posting p2 repositories in a way that is remotely consumable by other Maven builds?
_______________________________________________
tycho-user mailing list
tycho-user@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/tycho-user




--
Jeff MAURY


"Legacy code" often differs from its suggested alternative by actually working and scaling.
 - Bjarne Stroustrup

http://www.jeffmaury.com
http://riadiscuss.jeffmaury.com
http://www.twitter.com/jeffmaury

Back to the top