Thursday, June 28, 2012

Eclipse p2 Frustrations


Eclipse p2 continually frustrates me. For years I have been working around it and we have been peacefully coexisting. I recently tried to dip my toes back in the water to see if I could better understand it and use it better.  I have what seems to me a simple situation that would be common in the Eclipse world but I cannot find a satisfactory solution.

I have an Eclipse feature comprised of many plugins. These are intended to be installed in an Eclipse-based IDE and the assumption is that it should be possible to install it via the update manager UI of Eclipse or the Marketplace client. My feature extends a lot of other Eclipse plugins that need to be installed.  For example, it needs Subclipse, Mylyn, GEF and several other plugins.  Some of these are hosted on eclipse.org and some are on other sites.  I want someone to be able to install my feature and have any other features that are needed discovered and installed automatically and seamlessly.

The peaceful coexistence I have talked about is that I have been able to make this work by hosting all of the dependencies on the same update site as my feature.  This is labor intensive and kind of annoying but it worked so that is what I did.  I would much prefer to just publish a site that contains only my features and whatever pointers are needed for Eclipse to go get the rest of the plugins.  I cannot figure out any way to do it and I have not seen any other sites that do this successfully so I just assume Eclipse cannot do this.

Am I wrong in thinking this should not only be possible, but easy?

I have tried adding associate sites to the site.xml.  That did not do anything.   I tried adding a p2.inf file to my feature JAR's.  I could see that the UpdateSitePublisher added the instructions to the content.xml file, but it appears to add them in a place that would only be applied after my feature is installed.  So it does not help for my scenario of needing to add these sites to find required dependencies.  I am at a loss and about to go back to my ugly workaround.