更改现有 Eclipse 项目的资源位置

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

Changing the Resource Location of an existing Eclipse project

eclipse

提问by qbert220

I have wanted to do this a few times, for various reasons.

由于各种原因,我曾多次想这样做。

Firstly in the case where I have specified the Location incorrectly when I created the project. This project is part of a larger project, and I either want to go up or down a directory level to include more or less other stuff.

首先,我在创建项目时错误地指定了位置。这个项目是一个更大项目的一部分,我想要向上或向下一个目录级别以包含更多或更少的其他内容。

Secondly in the case where I have an existing eclipse project. I want to reuse the project on a different source tree (actually a different subversion branch of the same project).

其次,在我有一个现有的 eclipse 项目的情况下。我想在不同的源代码树(实际上是同一项目的不同 subversion 分支)上重用该项目。

The Resource Location field seems to be read only. The only way of achieving the above that I've found is creating a new project. Does anyone have any way of doing this?

资源位置字段似乎是只读的。我发现实现上述目标的唯一方法是创建一个新项目。有没有人有办法做到这一点?

Edit: I only want to change the Resource Location, not move the whole project.

编辑:我只想更改资源位置,而不是移动整个项目。

回答by Max

The location of a project is the location of its .projectfile. So you need to delete project (Do NOT select delete content checkbox), then move the .projectfile to a new location and import the project from there.

项目的位置是其.project文件的位置。所以你需要删除项目(不要选择删除内容复选框),然后将.project文件移动到新位置并从那里导入项目。

Creating new project does pretty much the same except you do not loose any project specifics/types.

创建新项目的作用几乎相同,只是您不会丢失任何项目细节/类型。

回答by jajalvipul

Yes. You can do that by using the following option:

是的。您可以使用以下选项来做到这一点:

On the Project, Right click and select option "Refactor" and then choose the option "Move". This will pop up a dialog box. Specify the folder where you want your project to be.

在项目上,右键单击并选择选项“重构”,然后选择选项“移动”。这将弹出一个对话框。指定您希望项目所在的文件夹。

Once the move operation is successful, your project is moved to a new location and you will see that Resource Location is pointing to a new folder that you have specified.

移动操作成功后,您的项目将移动到新位置,您将看到 Resource Location 指向您指定的新文件夹。