eclipse 工作区:如何重命名工作区
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5156093/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
eclipse workspace: how to rename workspace
提问by Alexx
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...
文件菜单中没有用于重命名工作区的选项。是否建议关闭 eclipse、重命名文件夹并重新打开?我担心配置文件中的一些潜在的悬空引用会破坏我的工作区/项目...
Thanks!
谢谢!
采纳答案by sgokhales
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.
是的,您可以重命名工作区目录和/或移动它。但是,您必须告诉 Eclipse 新工作区的位置。在 3.1 中,您可以使用“切换工作区”在不同位置启动(在“文件”菜单下)。
如果您想手动更改它,您可以在存储 Eclipse 的“配置”目录中的文件中编辑相应的条目。
如果您想在每次 Eclipse 在工作区所在的位置运行时被询问,您可以更改 org.eclipse.ui.ide.prefs 文件以设置 SHOW_WORKSPACE_SELECTION_DIALOG=true。
回答by Lord Henry Wotton
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.
无论如何,您可以通过选择 Eclipse->Preferences->General->Workspace 并将选项“工作空间名称(显示在窗口标题中)”从默认的工作空间文件夹名称更改为您想要的任何名称来重命名当前打开的工作空间。然后,重新启动 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".
假设您工作区的文件夹是“/foo/bar/workspace”并且您以前从未更改过它的名称;它的名称当时是默认的“工作区”。将其重命名为“my_workspace”并重新启动 Eclipse 后,Eclipse 的窗口标题应显示:“my_workspace -(一些不同的内容)- /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.
请注意,这不会修改工作区文件夹的名称。您可能需要创建一个具有所需名称的新文件夹,切换到该文件夹(默认情况下,其工作区将具有相同的名称)并将现有项目导入其中,正如某些人在此处建议的那样。
回答by Naju
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.
重命名工作区文件夹对我有用。关闭 eclipse,重命名工作区文件夹名称,再次启动 eclipse。如果您使用任何项目依赖项,如用户库、启动器等,您必须从项目构建路径手动将它们重新定位到新位置。
回答by Sameh Ragheb
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.
约翰,我认为在您导入项目的原始工作区中,项目依赖于链接而不是物理上位于工作空间的同一位置(即使它们已经存在,但依赖于链接)。如果是这样,您必须从新的(复制的)工作空间中删除项目,然后再次重新导入它们。
回答by Brent Worden
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.
将工作区复制到新文件夹有效。使用相对工作区位置解析 Eclipse 本身需要的任何参考。如果您添加了依赖于绝对工作区位置的启动器、替换变量等,则需要重置它们。
回答by Amitava 'Ami' Pal
I just did a:
我刚刚做了一个:
File --> Import --> Maven --> Existing Maven Projects --> mention the new workspace location in "Root Directory" in the "Import Maven Projects" window
文件 --> 导入 --> Maven --> 现有 Maven 项目 --> 在“导入 Maven 项目”窗口中的“根目录”中提及新的工作空间位置
and it worked! All projects were imported properly.
它奏效了!所有项目均已正确导入。
BTW, I have Eclipse-Maven plugin "m2e" installed (http://wiki.eclipse.org/M2E_updatesite_and_gittags)
顺便说一句,我安装了 Eclipse-Maven 插件“m2e”(http://wiki.eclipse.org/M2E_updatesite_and_gittags)