Monday, March 28, 2011

maven and tycho vs an Orion feature

EclipseCon 2011 has come and gone, and I was lucky enough to be there.  One of the nice things about going to speak at EclipseCon is the opportunity to see the other projects and technologies congregating around the Eclipse Foundation.  I'll blog later about the talks I gave, but one of the things I tried while down there was using Maven and Tycho to build a p2 repo.

I picked one of the Orion features.  My efforts can be seen in git:// in the mavenExperiment branch.

There are some things maven needs to get started, which I put in a parent pom.  A tycho-version property (I needed the 0.11.0-SNAPSHOT so a javax.servlet import package could resolve) and a pluginRepository so I could load that version of tycho.  The repositories to build from: 3 p2 repos in my case.  Some build plugin configuration I copied from the tycho RCP example, including configuring the qualifier with <format>'v'yyyyMMdd-HHmm</format>

The plugin poms are straight forward, as I want manifest first builds.  You just need to make sure the versions and IDs match.  Same with feature poms.

To generate the p2 repo you need to specify 2 things.  An eclipse-repository pom (relatively straight forward, although I've copied in extra maven plugin statements). And a category.xml that lists the features you want in the repo.

I list all of my modules in my aggregator pom, and then run "mvn clean install".

Ta da: a p2 repo with my 2 features in it.

I'm still encountering some problem either with my configuration or with tycho itself.  I open bugs for the $HOME/.m2/repository interfering with a second build: and trying to add extra categories to the p2 repo using category.xml results in the generated repo missing things:

I think there's some work to be done on the Execution Environment side as well, although JIRA appears to be down at the moment.

Once the build has been configured to run with maven, the next person just has to check out the code and "mvn clean install".  That looks promising.  I'm glad I had the opportunity to try out maven and tycho.