Monday, November 9, 2009

Eclipse Shared Plugins Directory

Did you know there is a way to point your local install of eclipse out to a shared directory containing the plugins? There is ... by way of a links folder. Now, there are a few other blogs out there if you google "eclipse plugins links folder", but hopefully you'll find mine as a good summary.Prerequisite:You must have your workspaces outside the eclipse home directory. This is not only best practice because it decouples your custom project from the eclipse installation, but it will also alleviate any pain point with my caveat below. (i.e.
. . c:\workspaces\HelloWorld


Steps:
1. On a shared drive, create the folder structure of:
. . eclipse\features
. . . . . . .\plugins
The folder must be called eclipse with subfolders matching exactly 'features' and 'plugins'. These folders should be empty initially. I put this entire structure under a root folder called "eclipse-plugins" so I can recognize it. Mine looks like this:
. . \\myShare\eclipse-plugins\eclipse\features
. . . . . . . . . . . . . . . . . . . . . . . . . .\plugins
2. Determine the net new plugins that you installed on top of the default ones from eclipse by sorting both the plugins directory and the features directory by "date modified". All the install provided ones come with the same timestamp. Move all the net new ones out to the shared location (i.e. plugins to the shared plugins directory and the corresponding features to the shared features directory.) Typically, each plugin has a corresponding feature to go with it. Be sure to grab both.
3. Create a new folder called "links" and place in your local eclipse home directory. (i.e.
. . c:\eclipse\features
. . . . . . . . .\
links
. . . . . . . . .\plugins

4. Inside links, create a new plain text file called plugins.link. (Technically, it can be called anything.link) In it put the line:
path=\\\\myShare\\eclipse-plugins
The path should not have a trailing slash and must point to the directory which has the eclipse folder.
(Yes, Windows needs to escape the backslashes. On Linux just do /myShare/eclipse-plugins.)
5. Download a fresh zip install of the eclipse version you wish to use. Add to this zip file your links folder with plugins.link file and re-zip it up. Put this file out on a shared drive and distribute to your team as the team's standard install. (Now, you've pre-packaged it with the links reference ready to go!)
6. Finally, launch eclipse. It will first load the plugins from your local eclipse home directory, then it notices the links/plugins.link file and proceeds to load any plugins from that path as well.

Things to note:
You only need the net difference between the share and the install. You don't want to put all the default ones out on the share.

Caveat:
It seems that once you start eclipse pointed to a share it caches what plugins it recognized. This means that if a plugin is deleted on the share, your eclipse might still try to load it the next time you start. I've tried starting eclipse with the command "eclipse -clean", but it doesn't seem to matter. However, it's not a big deal because now your eclipse home is nothing more than the install zip file (with your links folder) extracted. To pick up any shared plugin changes, simply delete your eclipse home directory and re-unzip the eclipse install. (You have your workspace elsewhere and any installed plugins elswhere so there is nothing you care to save in this directory anymore.) Start her up again and it will cleanly load all the plugins from the shared drive.

Sharing other eclipse settings:
I recommend making settings changes at the project level, not eclipse global level. Thus it puts the configuration in the .project file which can then be checked in with your project in SVN and checked out by others so they are ready to go. Else, if you use the eclipse global settings, at least put the settings files out in SVN and direct your team to do this one time setup each time they perform an eclipse install.

Oh and I need to give credit to a great post on the subject here: http://www.venukb.com/2006/08/20/install-eclipse-plugins-the-easy-way/

No comments:

Post a Comment