142

I'm using Eclipse (PDT) as primary IDE on different machines. (like at home, laptop, in office, etc.). How could I share the Eclipse and project configuration pragmatically between multiple computers? Should I version control them, or is there any easier way to do this?

How do you ensure to use the same good and old even so up to date config all of your computers?

erenon
  • 18,838
  • 2
  • 61
  • 93
  • I had all kinds of problems sharing code in a single workspace using Dropbox. I would lean towards having multiple workspaces, one for each machine, and syncronize the group of workspaces using Dropbox. – djangofan Jul 22 '11 at 17:27
  • 3
    Old question I know, but for posterity, I found this blog post very useful: http://mcuoneclipse.wordpress.com/2012/04/04/copy-my-workspace-settings/ (It's not my post :-) – Stewart Jun 25 '12 at 09:39
  • 1
    There are always complications on Windows envs. Checking workspace settings into source control is not an answer. Source control settings are part of the workspace settings. – chris topinka Mar 08 '13 at 16:47

11 Answers11

193

Sharing eclipse specific settings across workspaces:

  1. Go to ${old_workspace}/.metadata/.plugins/org.eclipse.core.runtime/.settings
  2. Copy everything under the above directory to ${new_workspace}/.metadata/.plugins/org.eclipse.core.runtime/.settings

This is going to make sure that the ${new_workspace} is having the same configuration as the ${old_workspace}

Update in case of any issues.

starball
  • 20,030
  • 7
  • 43
  • 238
peakit
  • 28,597
  • 27
  • 63
  • 80
  • 8
    I personally have those folders symlinked to dropbox and also RSE profiles are symlinked. Overall configuration of eclipse settings can be also exported from ide – Anton S Nov 30 '10 at 20:01
  • 6
    I'll start with this, but sadly there are many more settings outside of this directory that I'd like to synchronize. – David Harkness Oct 29 '12 at 16:34
  • @DavidHarkness: please elaborate - which settings - where ? You might post an answer [here](http://stackoverflow.com/questions/13334150/eclipse-workspaces-sync-settings-what-to-sync) - I am asking among others : "would it be safe and ***enough*** to hardlink the `\.metadata\.plugins\org.eclipse.core.runtime\.settings directory` ?" - to peakit : it's not as simple as that - the `${old_workspace}/.metadata/.plugins/org.eclipse.core.runtime/.settings` contains also workspace settings and has other peculiarities - see my analysis [here](http://stackoverflow.com/a/13547674/281545) – Mr_and_Mrs_D Jul 25 '13 at 12:27
  • To copy the folder use Robocopy: http://stackoverflow.com/questions/472692/how-to-copy-a-directory-structure-but-only-include-certain-files-using-windows – weberjn Jul 25 '14 at 14:26
  • 1
    To keep them in sync, consider Unison: http://www.cis.upenn.edu/~bcpierce/unison/ – Alice Purcell Apr 09 '15 at 11:10
125

Another option is export/import:

  1. From your existing workspace, File->Export...->General->Preferences, check Export all, and choose file to save them to (prefs.epf for example)
  2. Startup Eclipse in a new workspace, File->Import...->General->Preferences , choose your file (prefs.epf), check import all

That worked great for the original author of this tip: he had his code formatting, code style, svn repos, jres preferences imported.

Edit: On Eclipse Juno this works poorly. Some preferences silently do not carry over such as save actions.

David
  • 34,223
  • 3
  • 62
  • 80
Anthony Dahanne
  • 4,823
  • 2
  • 40
  • 39
9

It's a relatively new project, but it looks like Eclipse Oomph was created for exactly this reason. Through this tool you can create a unique configuration that can be shared with others. I have not used it (yet), but am planning to:

https://projects.eclipse.org/projects/tools.oomph

Dave
  • 21,524
  • 28
  • 141
  • 221
  • [Yatta Profiles](https://www.yatta.de/profiles) builds on Oomph/Eclipse Installer and makes sharing a bit easier. – Bernhard Stadler Mar 15 '18 at 10:19
  • 1
    @BernhardStadler Yatta does not transfer preferences. – ThomasMcLeod Oct 28 '19 at 17:51
  • Yatta can remember default preference values - workspace preferences can be recorded with Preference Recorder, and for project preferences you don't need any additional tools as you can add them to your SCM. The main intended use case one-click development workspace setup for teams with the goal of minimizing setup times, but synchronizing private profiles between different computers is also possible. I've never tried it myself but according to their web page, it is possibly to apply updates from online profiles, so it should be possible to use private online profiles as a sync mechanism. – Bernhard Stadler Oct 29 '19 at 09:01
7

I had to work on multiple workspaces simultaneously and there were a lot of preferences to be set each time I create a new workspace. I created a template workspace and created all the the required settings in that template workspace.Whenever I create a new workspace, I create a simlink of the {new_workspace}/.metadata/.plugins/org.eclipse.core.runtime/.settings to point to {template_workspace}/.metadata/.plugins/org.eclipse.core.runtime/.settings. So, when you edit any preference in any of the workspaces, it will be replicated across all other workspaces.

I created this function alias in my .profile so that once I create a new workspace, I run this function in my command prompt with my new workspace name as argument so that the link is created.

function eclset(){
    present_dir=`pwd`;
    cd  {parent_to_workspace}/$1/.metadata/.plugins/org.eclipse.core.runtime ; 
    rm -rf .settings ; 
    ln -s {parent_to_workspace}/template/.metadata/.plugins/org.eclipse.core.runtime/.settings .settings;
    cd $present_dir;
}
Mr_and_Mrs_D
  • 32,208
  • 39
  • 178
  • 361
Mowgli
  • 71
  • 1
  • 3
  • Actually that is what I wanted to do too (on windows) - but there are complications : see my answer [here](http://stackoverflow.com/a/13547674/281545) – Mr_and_Mrs_D Nov 27 '12 at 23:29
4

You can actually set many project specific settings that can be checked into source control. For small projects, this works really well. For larger projects, we decided to have a single file that we used for all of our projects and checked into a separate "assets" project that maintained things that developers needed to get started working on our project. This also included things like licenses and other required files.

Topher Fangio
  • 20,372
  • 15
  • 61
  • 94
4

As of Eclipse Neon (and possibly Mars), you can copy the following two directories, to share your workbench and settings/preferences amongst your different workspaces:

    [workspace]/.metadata/.plugins/org.eclipse.core.runtime/.settings
    [workspace]/.metadata/.plugins/org.eclipse.e4.workbench

UPDATE: These two directories still exist in Eclipse 2022-03 (note the change in version naming, from astronomy-related to YYYY-MM)

Antonio Malcolm
  • 314
  • 2
  • 6
  • Is it really introduced in Neon? Is there a changelog/readme or some other info that confirms this? – Danijel Jan 24 '18 at 09:23
  • Typically developers have their own GIT repository and not shared, so then the list is: 1. [workspace]/.metadata/.plugins/org.eclipse.core.runtime/.settings - Except [workspace]/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.egit.core.prefs 2. [workspace]/.metadata/.plugins/org.eclipse.e4.workbench – Timo Riikonen Feb 22 '18 at 10:42
  • @TimoRiikonen Git wasn't in the question, so we have no idea what versioning system is utilized by the question's author. However, your comment probably would be useful to those who use Git, so you might simplify / clarify your comment a bit, perhaps even offer it as an answer, so it stands out, with the clarification it's intended for use with Git. Cheers! – Antonio Malcolm Nov 03 '22 at 21:11
  • @Danijel I don't know if there's a changelog which mentions the Eclipse version which introduces the mentioned files to be copied. I mention *"As of Neon (and possibly Mars)"*, as that's the version I was on, when answering this question, and I was moving between those versions, and that's relevant info (lest someone on another version become confused). – Antonio Malcolm Nov 03 '22 at 21:16
1

There are two questions here. First, there are project definitions, the .project files and project specific settings. Personally, I like those in my source control, as it makes checking out a project and setting up an IDE much easier.

Second, you have the workspace settings. You will see a lot of questions in this area. I suggest taking a look at Pulse: it is an enhanced Eclipse distribution that can, among other things, save your workspace settings and sync them with multiple machines or team members.

zvikico
  • 9,765
  • 4
  • 38
  • 49
1

You can also copy the .prefs files from ${old_workspace}/.metadata/.plugins/org.eclipse.core.runtime/.settings to a folder called .settings in the root folder of your project and then add it to SVN (or CVS or ...)

That way the settings will get distributed to all developers along with the source code during an Update.

CoolBeans
  • 20,654
  • 10
  • 86
  • 101
Evvo
  • 481
  • 5
  • 8
0

i had the same problem.

my approach: storing project data in a directory managed by owncloud

The Project X is created at workstation A, with a custom path pointing to a new sub directory of my ownCloud hierarchy. The default workspace is still residenting on the file system of A.

When I'm sitting at workstation B I open the default local workspace (local on B) and create a new project using the existing sources in the "synchronized" ownCloud directory.

Just click refresh any time you fire up eclipse and you have the current project data. Synchronisation runs in the background automagically, so take care when you have finished working to close eclipse and give ownCloud a chance for uploading the new files to the ownCloud server.

Tomcat or other Servers are running local, the config is copied manually between the machines via scp. This happens only if there are changes in the server setup, which is not very often.

I had no compatibility problems using NEON 2 (arch linux) & NEON 3 (download an running on debian stretch) with different JDK's yet.

Best regards Armin

armin
  • 1
0

Simply copy the directories

${old_workspace}/.metadata/.plugins

from an existing project to the new one.

That worked well within (rather simple) PHP projects.

schogol
  • 53
  • 11
0

You can use Eclipstyle to clone preferences of one workspace to your other workspaces. You can also export your preferences and clone them later.

Utku Ufuk
  • 318
  • 1
  • 10
  • 24