如何将 eclipse (helios) 项目移动到不同的工作区?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7180474/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 20:27:38  来源:igfitidea点击:

How to move an eclipse (helios) project to a different workspace?

eclipsehelios

提问by Olie

First, Eclipse is not my native IDE -- I'm barely a n00b with it. I set up a project in a workspace that was actually in the directory of another client's project (I didn't really follow the whole workspace/project thing) and, in fact, now I can't even find the Eclipse workspace file to open it.

首先,Eclipse 不是我的原生 IDE —— 我对它几乎不熟悉。我在一个工作区中设置了一个项目,该项目实际上位于另一个客户项目的目录中(我并没有真正关注整个工作区/项目),事实上,现在我什至找不到要打开的 Eclipse 工作区文件它。

What I'd like to do is:

我想做的是:

  • Open my eclipse project (/workspace?) -- I know where all the files are on disk, just not what to open in order to see them in Eclipse -- and

  • Move my project to a new workspace, which I guess I will put in a generic Eclipse-y place, and have that one workspace reference all my Eclipse projects.

  • 打开我的 eclipse 项目(/workspace?)——我知道所有文件在磁盘上的位置,只是不知道为了在 Eclipse 中看到它们而打开什么——和

  • 将我的项目移动到一个新的工作区,我想我会将它放在一个通用的 Eclipse-y 位置,并让该工作区引用我所有的 Eclipse 项目。

(Is that the right way to do it? Does Eclipse dislike me being a one-project == one-workspace kind of guy?)

(这是正确的做法吗?Eclipse 不喜欢我成为一个单一项目 == 一个工作区的人吗?)

Please educate me regarding The Eclipse Way so that I can get back to work writing code.

请教我有关 Eclipse 方式的知识,以便我可以重新开始编写代码。

Thanks!

谢谢!

回答by Davz

Roughly a workspace (which is a directory) in Eclipse contains:

Eclipse 中的工作区(即目录)大致包含:

  • configuration (installed JRE, Servers runtimes, code formatting rules, ...)
  • one or more projects
  • 配置(已安装的 JRE、服务器运行时、代码格式规则等)
  • 一个或多个项目

You can of course have as many workspaces as you want (but only one can be opened at a time) and a project can also be part of different workspaces.

您当然可以拥有任意数量的工作区(但一次只能打开一个),并且一个项目也可以是不同工作区的一部分。

If you know where your sources are and want to move them to a new workspace here is a possible solution:

如果您知道您的源在哪里并希望将它们移动到新的工作区,这里是一个可能的解决方案:

  • Start Eclipse and when prompted for a workspace choose where you want the workspace to be created (if directory doesn't exist it will be created). For example you can choose C:/Dev/Workspace/.
  • If you are not prompted, go to File->Switch workspace->Other
  • Once you are in your workspace you can import your exisiting project with File->Import then General->Existing Projects into workspace
  • Navigate to the folder containing your project sources, select your project and click finish
  • 启动 Eclipse 并在提示输入工作区时选择要创建工作区的位置(如果目录不存在,则将创建该目录)。例如,您可以选择 C:/Dev/Workspace/。
  • 如果没有提示,进入文件->切换工作区->其他
  • 进入工作区后,您可以使用 File->Import then General->Existing Projects 将现有项目导入到工作区
  • 导航到包含您的项目源的文件夹,选择您的项目并单击完成

I don't know if it's a best practice or not but what I usually do is the following:

我不知道这是否是最佳实践,但我通常会做以下事情:

  • I have one workspace for each of my customer (workspace_cust1, workspace_cust2)
  • Each workspace references my commons library projects and add client specific projects
  • 我的每个客户都有一个工作区(workspace_cust1、workspace_cust2)
  • 每个工作区都引用我的公共库项目并添加客户特定的项目

This way each time I change my commons library it's up to date in every workspace.

这样,每次我更改公共库时,它都会在每个工作区中保持最新状态。

回答by VirtualTroll

If you want to apply

如果你想申请

one workspace = one project

一个工作区 = 一个项目

You could to the following:
1) Copy the eclipse desktop shorcut
2) Modify the shortcut by appending "-dataworkspaceLocation "

您可以执行以下操作:
1) 复制 eclipse 桌面快捷方式
2) 通过附加“ -dataworkspaceLocation”来修改快捷方式