Eclipse’s big strength is its plugins – they make it easy to add new features to the IDE. But plugins can make life difficult when you have to reinstall Eclipse (eg. moving up a version) or have multiple installations (eg. for C++, Java and PHP). Because plugins are normally installed in the plugins folder underneath your Eclipse installation, they aren’t shared by other installations
You could always install the plugins again and again for each installation. That would mean for Subclipse (or favourite), your favourite XML editor, UML tool, etc. This is extremely slow and frustrating.
There is a feature that makes life easier though. You can copy plugins to an external folder and create shortcuts to them via link files. Then you can copy these link files to any Eclipse installation.
How to set up link files to share plugins
To see how to use link files, I’ll add the popular code checker Checkstyle to Eclipse. I’ll be using a technique shared in this post (by Michael Scharf) to make things work smoothly with p2, Eclipse’s new provisioning system.
1. First, download the plugins (Checkstyle download), preferably in zip format for local install (ie. not via an Eclipse update site).
2. Create a folder where you’ll be storing all your plugins. I use C:\eclipse-plugins for all my plugins but you can place them anywhere and even in totally different locations.
3. Extract the Checkstyle zip under the folder c:\eclipse-plugins\Checkstyle\eclipse (notice the eclipse folder underneath Checkstyle’s folder).
If you’re unsure about how to create the folder structure, have a look at this video:
4. Create a file called .eclipseextension (note the dot in front) in the folder c:\eclipse-plugins\Checkstyle\eclipse, with the following content:
(Alternatively, download the file, rename it to .eclipseextension and copy it into the same folder).
NB! This step is only necessary since Eclipse 3.6 (Helios), but will work on previous versions as well and should make sure you’re covered in case you upgrade to 3.6 – (thanks Rab).
5. Start up Eclipse with the following command line to initialise all the p2 stuff in the external folder. You only have to do this once:
eclipse -configuration c:\eclipse-plugins\Checkstyle\eclipse\configuration
6. Go to your Eclipse installation folder and add a folder called links. In this folder, create a link file named Checkstyle.link (with your favourite text editor) with the following content (NB! Notice the front slashes, even in Windows):
If you’re unsure about how to create the link file, have a look at this video:
7. Restart Eclipse normally (without the command line args) and you’re done. You should see your new plugin’s functionality, in our case the Checkstyle views should appear on the Show View menu. If you don’t, see the troubleshooting section below.
8. Now you can copy this links folder over to as many Eclipse installations as you want. You have to create one file per tool/extension, so if you’re installing Subclipse, there should be a Subclipse.link in the links folder pointing to Subclipse’s plugins.
- Eclipse expects plugins to be in the plugins folder and features in the features folder of the external location.
- If you’re dealing with a tool that doesn’t have plugins or features folders (eg. XMLBuddy has only one plugin folder) then be sure to create a plugins folder below the eclipse folder and drop the plugin in there.
So how do you share the plugins between installations or reinstall using links?
Simple. Once you’ve got the links folder set up in one installation, copy it to the other Eclipse installs you have. You only have the plugins defined once (under c:\eclipse-plugins) and the link files are basically shortcuts (or symbolic links) to these plugins.
Reinstalling is easy as you only have to either recreate the links folder and files in the new installation or just restore a copy of the links folder you had before from a backup.
Once you’ve copied the links folder, Eclipse should pick up the plugins when you start it. If it doesn’t, see the troubleshooting section below.
Troubleshooting – It’s not working
Here are some common reasons why it may not be working:
- You didn’t create a folder called eclipse between the plugin’s name and the features and plugins folders. For example, we copied the Checkstyle zip’s content to the folder c:\eclipse-plugins\Checkstyle\eclipse.
- You should use front slashes instead of backslashes in your link file.
- The link filename must end with the .link extension. Eclipse doesn’t recognise any other file type.
- You might not have initialised the p2 stuff. Remember to run eclipse the first time with the -configuration argument.
- If you’re using Eclipse 3.6, you might have skipped the step where you need to copy over the .eclipseextension file.
- If it’s still not working, you might have a dependency problem, version problem or something else wrong with your plugin. See the Error Log view (Alt+Shift+Q, L) in Eclipse to see if there are any errors.
But what about p2? Aren’t links going out?
Not really. p2 (Eclipse 3.5’s new provisioning system) has introduced a new way of adding external locations, but it does still support the old-style links.
In p2, you can also put your link files in the dropins folder without needing to create a links folder. However, remember that the dropins folder can also contain other plugin jars and folders.
My recommendation? I still prefer old-style links folder because (a) it only contain the link files so is a lot cleaner and (b) it’s easier to copy because it only contain link files.
There is a small caveat, though, but really small
There is a small caveat to using link files, but it’s really inconsequential compared to the benefits you gain by being able to share plugins: To use the update manager to update plugins the external location, you have to start Eclipse again with the -configuration argument and give the path to the tool. Then you can use update manager as normal, update the plugins and run Eclipse again as normal.
Not really a problem, but just something to keep in mind.
Here are some other things you can do to make your installation and setup easier:
- Checkout multiple projects automatically into your Eclipse workspace with Team Project Sets
- Share Eclipse perspective layouts across multiple workspaces
- Use Fast Views to maximise screen space
- Automatically format and cleanup code every time you save
- Categorise projects in the Package Explorer to reduce clutter in Eclipse