Friday, February 20, 2009

p2: how I install plugins in extension locations...

The following procedure explains how I install plugins into different extension locations and share those extension locations between different eclipse installations using the p2 update manager and link files. For a lengthly discussion see bug bug 224145

I keep a set of different extensions locations in C:\eclipse\extensions (each extension location is in a subdirectory of that directory). Suppose I want to install foo into the new extension location C:\eclipse\extensions\foo.

  1. I start eclipse with:
    -configuration C:\eclipse\extensions\foo\eclipse\configuration

  2. I install foo using the update manager.

  3. Now I can use the extension by creating a foo.link file inside the links directory of an eclipse installation (you might have to create the links directory) containing:
    path=C:/eclipse/extensions/foobar

That's it :-)


Note: You have to the forward slashes on windows in the links file.

Note: This procedure works for eclipse 3.4 and 3.5.

Note: You don't have to create any directory specified by the -configuration parameter. Eclipse will do that for you.

Note: It is important to follow the pattern EXTENSION_NAME/eclipse/configuration for the -configuration parameter because p2 will put the plugins one directory above the configuration directory and link files require that the directory that contains the plugins is called eclipse.

Note: With this structure I can update plugins into the extension locations by running eclipse with the -configuration and then do the update.

Advanced use: If I want to install bar based on my foo extension, I create a link file to foo in the bar extension location links directory:
C:\eclipse\extensions\bar\eclipse\links\foo.link
and follow my standard procedure described above (the links directory can be populated before the first run of eclipse)...

Note for eclipse 3.4: If you are using eclipse 3.4 and you want to use the eclipse default update sites, you have to run eclipse without -configuration and export them (Help->Software Updates->Available Software (tab)->Manage Sites->Export), so you can import them into the -configuration eclipse.

Note for eclipse 3.5M6: You have to add an (empty) .eclipseextension file next to the plugins and features directory of the extension location.