Java 在 Eclipse 工作区中手动重命名项目

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

manually renaming project in eclipse workspace

javaeclipse

提问by user2737926

I manually renamed project in work space rather than using refactor. I lost all files from that project folder. However, the new folder had created with the project name which I tried to rename with all files which i lost from original project folder which i renamed.So , I copied all files from new renamed project folder back to original project folder which I renamed .But ,I can't find any files in that original project folder in eclipse.

我在工作空间中手动重命名了项目,而不是使用重构。我丢失了该项目文件夹中的所有文件。但是,新文件夹已使用项目名称创建,我尝试使用从我重命名的原始项目文件夹中丢失的所有文件重命名该项目名称。因此,我将新重命名的项目文件夹中的所有文件复制回我重命名的原始项目文件夹。但是,我在 eclipse 的原始项目文件夹中找不到任何文件。

采纳答案by blgt

Go into the project folder, delete the .project and .classpath files, and the .settings folder. These contain outdated Eclipse-specific metadata, which is why Eclipse can't find your project.

进入项目文件夹,删除 .project 和 .classpath 文件,以及 .settings 文件夹。这些包含过时的特定于 Eclipse 的元数据,这就是 Eclipse 找不到您的项目的原因。

Go back into Eclipse, and go File -> New project... -> Java project

回到 Eclipse,然后转到 File -> New project... -> Java project

If it's stored in your workspace, just type in the new path in the Name field; If it's not stored in your workspace, untick "Use default path" and select the folder where your project is.

如果它存储在您的工作区中,只需在名称字段中输入新路径;如果它未存储在您的工作区中,请取消选中“使用默认路径”并选择您的项目所在的文件夹。

Et voila! Eclipse will generate new metadata, and all your source/binaries will still be present.

等等!Eclipse 将生成新的元数据,并且您的所有源代码/二进制文件仍将存在。