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.

5 comments:

  1. Thank you very much for this tip, I was looking for something like this since p2 did away with extension locations. I wanted my setup as I had it before p2, which was one eclipse platform installation, started with different configurations and therefore different plugins. So I downloaded the eclipse platform zip, unzipped it and started a "java" configuration to install the JDT, to have a pure Java environment, the I installed a "rails" configuration, no java needed there, worked great. Then I installed a "pdt" configuration and linked the "java" plugins in via the links folder, started it, worked. In this configuration I installed the PDT plugins and the eclipse SDK and the eclipse platform SDK (to be honest, I don't know exactly what the difference is between the two). After this my "java" and "rails" configuration did not work anymore, there was an error, that the platfrom id or something couldn't be found. I assume something in the PDT or SDK was changing something in the base eclipse platform and that borked the other configurations. Any idea what this could be?

    ReplyDelete
  2. Thanks for the recipe! A couple of comments:

    - As far as I can tell 'links' has been replaced by dropins -- so .link files in the dropins directory work equally well.

    - This doesn't work if the extension installed is not p2 compatible (e.g. ccrc). For this, using old UM, you must install the extension somewhere not under the current configuration. You add the .eclipseextension file as before, and can then link to that install location.
    (If you put it under the current config, and link to it, you will be unable to disable / uninstall the plugin from the linked location.)

    I've had some success in p2-izing the CCRC update site, but that's a different story :)

    ReplyDelete
  3. Thanks for this tip.

    Three questions:

    1. When installing a new extension do you work with a clean install (without any links in it)? (I think this is important for how dependencies are handled)

    2. Did you install the 'base' eclipse using the normal 3.x.zip or did you use p2 agent and the sdk is installed as an extension too?

    3. Do you use a naming scheme "foo" or "foo.Version" for the extensions (this means do you update extensions when they change or just install the extension in a new link dir? The later one would allow the user to decide which version to use.)

    Frank

    ReplyDelete
  4. Frank,

    1. sometimes i start with some link files that contain things my new extension location depends on.

    2. I normally use .zip file to start with

    3. I have a set of extension locations for each major version of eclipse. But using a scheme with version number might also be a good idea...

    Michael

    ReplyDelete
  5. Cannot complete the install because one or more required items could not be found.
    I tried this with Helios and it giving below error what should I do.


    Software currently installed: Shared profile 1.0.0.1318040795057 (SharedProfile_epp.package.java 1.0.0.1318040795057)
    Missing requirement: Shared profile 1.0.0.1318040795057 (SharedProfile_epp.package.java 1.0.0.1318040795057) requires 'org.maven.ide.eclipse [1.0.100.20110804-1717]' but it could not be found

    ReplyDelete