Skip to main content

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

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?

Back to the top