eclipse workspace: how to rename workspace
Asked Answered
V

7

87

There is no option in the file menu to rename a workspace. Is the recommended practice to close eclipse, rename the folder, and re-open? I worry about some potential dangling references in configuration files corrupting my workspace/projects...

Thanks!

Viv answered 1/3, 2011 at 14:52 Comment(3)
If you are meaning how to rename a project, right click to project then: project -> refactor -> rename. Also you can move in another dir with project -> refactor -> move.Accentual
The command File > Switch Workspace may help you.Yellowhammer
Thanks - meant any of the drop-down menus, would have expected it to be in 'file'. I just wanted to filter out b2c projects and rename the general workspace to b2b, but maybe I will just make a new workspace.Viv
S
61

Source : Renaming a workspace?

Yes, you can just rename the workspace directory and/or move it. However, you then have to tell Eclipse where the new workspace is. In 3.1, you can use 'switch workspace' to launch in a different location (under the File menu).

If you want to change it by hand, you can edit the appropriate entries in the files in the 'configuration' directory where Eclipse is stored.
You can change the org.eclipse.ui.ide.prefs file to set SHOW_WORKSPACE_SELECTION_DIALOG=true if you want to be asked each time Eclipse is run where the workspace is.

Shanks answered 1/3, 2011 at 15:40 Comment(5)
This will mess up Subclipse SVN data... result: "Path is not a working copy directory"Compote
Thanks..I did the above steps and after switching to new workspace I had to delete the project folders from workspace(without deleting the contents) and did an import again, it worked for me after that.Brecciate
This worked perfectly with me, despite my use of SVN. I separate my Eclipse workspace from my code directories, so changing the name of the workspace had no affect on the Subversion data. One suggestion: copy the existing workspace to the new name instead of renaming it. If you have a problem, it's easy to restore the old workspace.Roden
The path to the configuration file is something like: eclipse_home/java-mars/eclipse/configuration/.settings. The last folder is hidden so it may not be obvious.Undercast
As Steve Gelman correctly noted - it is good practice to separate your workspace (only used by Eclipse to store metadata of your project) from your project source files (SVN, Git, or any other VCS workspace), and always do the backup copy before making any changes (to be able to revert to it in case if something goes wrong after renaming).Bloom
B
20

For simple renaming, it is not necessary to switch workspaces, unless the workspace you want to rename is not the one currently active.

Anyway, you can rename the current open workspace by choosing Eclipse->Preferences->General->Workspace and changing the option "Workspace name (shown in window title)" from the default's workspace folder name to whatever you want to call it. Then, restart Eclipse.

Suppose your workspace's folder is "/foo/bar/workspace" and you never changed its name before; its name was then the default "workspace". After you renamed it to, say, "my_workspace" and restarted Eclipse, the Eclipse's window title should show: "my_workspace - (some stuff that varies) - /foo/bar/workspace".

Note that this is NOT going to modify the workspace folder's name. You may have to create a new folder with the desired name, switch to that folder (whose workspace will have the same name, by default) and import existing projects into it, as some have suggested here.

Bradberry answered 1/11, 2013 at 21:4 Comment(1)
I followed this procedure and everything worked. Regarding the last paragraph I just had to rename the folder before restarting Eclipse, I did not have to re-import existing project. I'm using Eclipse Oxygen.Gooch
J
3

Renaming Workspace folder worked for me. Close the eclipse, rename the workspace folder name, launch eclipse again. If you are using any project dependencies like user libraries,launchers etc, you have to relocate those to new location manually, from project build path.

Jannajannel answered 27/5, 2014 at 6:41 Comment(0)
S
2

Copying workspace to a new folder works. Any reference Eclipse itself needs is resolved using the relative workspace location. If you have added launchers, substitution variables, etc. that rely on the absolute workspace location, they will need to be reset.

Schaaf answered 1/3, 2011 at 15:35 Comment(0)
L
2

John, I think in the original workspace you imported projects and that the projects depend on links not on being physically in the same location of the worspace (even thay are there already but the dependency is on links). If so you have to remove the projects from the new (copied) worspace and then re-import them again.

Lisandra answered 18/1, 2012 at 19:4 Comment(1)
To complete the story, export your workspace preferences in the 'old' workspace and import them again in your new workspace. This will keep your settings like repositories etc. (see help.eclipse.org/juno/…)Fernald
S
1

I just did a:

File --> Import --> Maven --> Existing Maven Projects --> mention the new workspace location in "Root Directory" in the "Import Maven Projects" window

and it worked! All projects were imported properly.

BTW, I have Eclipse-Maven plugin "m2e" installed (http://wiki.eclipse.org/M2E_updatesite_and_gittags)

Sibby answered 2/5, 2013 at 17:35 Comment(0)
A
0

2021 Update

In Eclipse 2020-12 (Windows 10), the "Workspace name (shown in window title)" preference mentioned in one answer is no longer there. Now, renaming a workspace (WS) requires a copy and delete operation.

Start by switch to another WS: File --> Switch Workspace --> select existing WS. Then rename the WS folder to desired new name. Switch to the new workspace folder and delete the old name:

  1. File --> Switch Workspace --> Other...
  2. Right-click old WS name --> Remove from launcher selection
  3. Click Browse --> select new workspace folder --> click Launch and Voila!

As mentioned in prior posts, depending on your setup some resource links may be broken. Delete the project without(!) removing it from disk, then import to new WS.

Ascham answered 7/2, 2021 at 21:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.