ChatGPT解决这个技术问题 Extra ChatGPT

How to Clone an Eclipse Workspace

I am wondering how to create new clean Eclipse workspace but having all settings from an existing one. Maybe something like cloning but without projects?

Which settings exactly are you referring to? Can you give an example?
there are lots of settings, maven,subclipse repositories, etc...

k
kostja

I use export->preferences->all then change to a new workspace and import the prefs. Works fine (though clearly not very comfortable). Unfortunately, eclipse only offers to copy the layout settings when changing workspaces which is not enough for most purposes.


Only solution I've found to be robust. Also you will need to do it again when upgrading to a new release (3.5->3.6 etc)
the best way to handle it is to use code.google.com/a/eclipselabs.org/p/workspacemechanic
Just a note that workspacemechanic seems to be abandoned and looks like it will die when Google shuts down Google code
this doesn't copy the views etc, so i still have all the wrong tabs in the wrong places
yeah, it does not work for layouts. not aware of any way to sync those.
N
NullUserException

You can have a look at the following plugin : http://code.google.com/a/eclipselabs.org/p/workspacemechanic/

It's a plugin developed by google which lets you store your preferences and apply them to any workspace automatically.

If you store it in your dropbox (or any other shared storage), you'll be able to share you preferences between all your computers and even between all your team members.

It's the best and most reliable solution for your problem.


The plugin is not developed by Google and is currently abandoned project on dying Google code
T
Tod

My preferred method is to copy both the .settings folder and the .launches folder from the old workspace to the new workspace. This seems to do a more complete job than using the export preferences option. You can find both folders under your workspace starting at
.metadata\.plugins
The .settings folder can be found under the org.eclipse.core.runtime folder The .launches folder is under the org.eclipse.debug.core folder.

(Just one of many tricks covered in my two Eclipse Guided Tour video training courses on Pluralsight.)

https://i.stack.imgur.com/8kV4U.jpg


B
Bozho

You can try copying the workspace/.metadata folder. It mainly contains plugin information, and it is possible that you don't have some of the plugins. The specific folder that contains important settings is .metadata/.plugins/org.eclipse.core.runtime/.settings. See this article


I guarantee you this will not work. The .metadata folder is full of absolute path and isn't meant to be portable.
@Konstantin Komissarchik today I checked two .metadata folders and none of them contained absolute paths. Perhaps you are mistaking workspace metadata with project metadata? The project metadata indeed contains absolute paths.
If your project metadata has absolute paths, you aren't configuring your projects well... Where the absolute paths are located in .metadata is dependent on plugins you have installed and how you use Eclipse. Also note that some of the .metadata content is binary, so your ability to search it with basic tools is limited.
@Konstantin Komissarchik about the project metadata - my point was that it can contain absolute paths (whether it should is a different story). Btw, see my update - I linked to an article.
Point taken on projects. I would not recommend following the advice given in the cited article. While the referenced location is indeed the common storage for preferences (backs the InstanceScope preferences API), I know of many plugins that store a lot of free-form information elsewhere in the .metadata folder. These plugins will likely malfunction in a weird manner when confronted with inconsistent state of the metadata. Plugins aren't typically written to be robust to end-user editing .metadata folder...
M
Matija Han

No need to copy anything manually, use Workspace Preferences Transferrer - it works great. Here is the quote from the description:

Extends the File > Switch Workspace… command with the option to transfer all preferences from the current workspace to the other one.

Just search the Eclipse marketplace and install it from there.


Worked for me !
s
san242

Need to copy .Metadata that holds the properties of your workspace.


M
MSN

Best way is to copy the .metadata folder to a new folder and open that folder in Eclipse Workspace dialog box.


copy .metadata folder from existing workspace folder
s
somenickname

Just copy the whole workspace on your local file system. That works for me because my new feature branch is got the same pom file and thus the overall build matches up. This way I don't need to import all the projects again.


L
Leon

This plugin will help you: http://marketplace.eclipse.org/content/workspace-preferences-transferrer.

Select "copy preferrences" when switch to or create a new workspace.