34

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.

Robert Munteanu
  • 67,031
  • 36
  • 206
  • 278
  • Note: you now (Dec. 2014) have a new project which proposes a set of settings as an Eclipse plugin: See [my answer below](http://stackoverflow.com/a/27353744/6309) – VonC Dec 08 '14 at 08:06

5 Answers5

19

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.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • That's a very good suggestion. Do you keep them in sync using git as well or do you have a script running some sort of git export and pulling them back? – Robert Munteanu Jun 04 '09 at 19:39
  • Actually, it is still kind of manual, but git allows you to pull those files, while merging them if they already exists (which is the case when your project already has some specific settings) – VonC Jun 04 '09 at 20:24
  • 2
    What would be nice is some kind of middle ground between project-specific settings (too granular for me), and global/local workspace-level settings(not easily shareable). Something similar to the .target files (which are shareable but common between related projects) - rather than a per-project on/off flag, have some link to my preference store. – inger Jun 24 '11 at 20:49
6

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

walderik
  • 111
  • 1
  • 2
3

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:

Miles
  • 31,360
  • 7
  • 64
  • 74
  • 2
    It would have been so much easier if Eclipse just used a preference template when creating a workspace that we could edit. That's all that most people want. Oomph looks like it's swatting a gnat with a shotgun. – JonS Jan 29 '19 at 19:30
2

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
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
1

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

zvikico
  • 9,765
  • 4
  • 38
  • 49