33
votes

Whenever I switch workspaces/Eclipse installs I need to copy/redo the preferences:

  • compiler settings;
  • font sizes/families;
  • code formatter;
  • java code templates;
  • editor templates;
  • code clean-ups;

I would like to maintain these settings in an unitary way, preferrably under source control. How can I do that?


I know about 'copy settings' when creating a new workspace, but it does not keep updated copies.

5
Note: you now (Dec. 2014) have a new project which proposes a set of settings as an Eclipse plugin: See my answer below - VonC

5 Answers

19
votes

You could of course export/import those settings.

The other approach is to enable project specific settings for some settings.

http://www.peterfriese.de/wp-content/downloads/images/formatter_project_specific_settings.jpg

We have a very small Git repository with those kind of files:

http://www.mkyong.com/wp-content/uploads/2009/01/wicket-examples-7.jpg

  • .settings/org.eclipse.jdt.core.prefs (compiler problem settings and formatter rules)
  • .settings/org.eclipse.jdt.ui.pref (cleanup rules, common code templates)

The common settings are just copied/merged in each projects .settings directory, ensuring common rules amongst all projects, whatever the workspace.

6
votes

You could also try Workspace Mechanic. It works perfect for this. http://code.google.com/a/eclipselabs.org/p/workspacemechanic/

2
votes

You now have a good example of a separate project maintaining Eclipse preferences, as plugin.

See the saneclipse project from Lars Vogel.

You also have the associated vogellacompany/com.vogella.saneclipse repo, which will tweak and fine-tune the settings of:

com.vogella.saneclipse.preferences/.settings/org.eclipse.jdt.core.prefs
com.vogella.saneclipse.preferences/.settings/org.eclipse.core.runtime.prefs
com.vogella.saneclipse.preferences/.settings/org.eclipse.core.resources.prefs
com.vogella.saneclipse.templates/.settings/org.eclipse.jdt.core.prefs
com.vogella.saneclipse.fileextensions/.settings/org.eclipse.jdt.core.prefs
com.vogella.saneclipse.fileextensions/.settings/org.eclipse.pde.core.prefs
2
votes

Eclipse now ships with a tool called Oomph Setup. This tool can be used to record the preference changes that happen in your workspace, synchronize those preferences across multiple machines using an online service, and apply the preferences to both new and existing workspaces.

"Oomph" is actually a broader set of tools and low-level frameworks that are used throughout the Eclipse installation process, and it provides for very powerful automation possibilities, so the documentation is sometimes hard to follow for an end user who's just interested in simple preference synchronization. Here are a collection of links about Oomph Setup that I found helpful:

1
votes

Check out Pulse Freelance Edition. It has the ability to sync workspaces (commercial).