Migrating your p2 application to Eclipse 3.5

February 5, 2009 | 2 min Read

Anybody building plugins / products / tools based on Eclipse, Milestone 5 is a pretty important time.  The API should be stable, most of the features should be spelt out, and the new splash screen is here :-).

If you haven’t been keeping up-to-date with the milestone builds, you should really consider getting M5 and setting it as your target. There may be a few changes needed.  I discovered these changes while helping a few friends port their code based on p2, to Eclipse 3.5.  I thought I would document some of the hurdles we had to go through.

  1. Version is now called Version. To be more specific org.osgi.framework.Version is now called org.eclipse.equinox.internal.provisional.p2.core.Version.   p2 uses the new Version class everywhere, so if you use p2, you will likely have to update your import statements, and in some cases, your plug-in dependencies.
  2. Because of the changes to Version, VersionRange has also changed. Update org.eclipse.osgi.service.resolver.VersionRange to point to org.eclipse.equinox.internal.provisional.p2.core.VersionRange.
  3. URL are now URIs.  Next to version, this is probably the  biggested change.  This is a little easier as you should not need to touch your dependencies for this one.
  4. Metadata interfaces.   If you used ProvideCapabilities, RequiredCapabilities, TouchpointData, License, Copyright, or anything else in the metadata bundle, you will likely need to put an I on the front.  That is: IProvidedCapabilities, IRequiredCapabilities, etc…
  5. Changes to the Query API.  The Query API has a little more structure to it.  The most common use of Query was to Extend Query and override isMatch.  IsMatch would then be used as a filter to select / reject elements.  However, this was not the only use. You could also extend Query and override perform to build a query that requires more context.  To make this more explicit, two types of queries were created.  MatchQueries and ContextQueries.  How does this affect you?  Likely you just have to extend MatchQuery (instead of Query).  However, if you created a custom perform, then extend ContextQuery.
  6. There were a few other small changes (method name changes, etc..).  

I think all these changes are positive, and they should make for a more stable base moving forward.

Ian Bull

Ian Bull

Ian is an Eclipse committer and EclipseSource Distinguished Engineer with a passion for developer productivity.

He leads the J2V8 project and has served on several …