Eclipse:完全删除旧项目?

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

Eclipse: fully remove an old project?

eclipseproject

提问by Bruno Girin

I run eclipse on Ubuntu 11.10. I originally created a project in folder foo. I subsequently deleted that project to re-organise folders and I now want to create a new project in folder foo/barbut Eclipse won't let me because it says the the new directory is a sub-directory of an existing project.

我在 Ubuntu 11.10 上运行 eclipse。我最初在文件夹foo 中创建了一个项目。我随后删除了该项目以重新组织文件夹,现在我想在文件夹foo/bar 中创建一个新项目,但 Eclipse 不允许我,因为它说新目录是现有项目的子目录。

How can I force Eclipse to forget about the original project so that I can create the new one?

如何强制 Eclipse 忘记原始项目以便我可以创建新项目?

回答by Alécio Carvalho

In general, the deleting the project from the "/.metadata/.plugins/org.eclipse.core.resources/.projects"should work, but if you're using 'working sets', you might have the problem I had once, which is basically have a 'ghost' project in your workspace that you can't delete because it says "this project doesn't exist anymore".

一般来说,从“/.metadata/.plugins/org.eclipse.core.resources/.projects”中删除项目应该可行,但如果您使用的是“工作集”,您可能会遇到我曾经遇到的问题,它基本上在您的工作区中有一个“幽灵”项目,您无法删除它,因为它说“这个项目不再存在”。

If this is your problem, try to delete an entry for your 'ghost project' in the file:

如果这是您的问题,请尝试在文件中删除“幽灵项目”的条目:

"/.metadata/.plugins/org.eclipse.ui.workbench/workingsets.xml"(on MacOS).

“/.metadata/.plugins/org.eclipse.ui.workbench/workingsets.xml”(在 MacOS 上)。

回答by Kajal

Delete the project from /.metadata/.plugins/org.eclipse.core.resources/.projects and not the whole .metadata folder will save all other projects and config.

从 /.metadata/.plugins/org.eclipse.core.resources/.projects 中删除项目,而不是整个 .metadata 文件夹将保存所有其他项目和配置。

回答by schmopinions

I have also encountered this problem, except it's been in Windows. I didn't want to completely remove the .metadata folder and none of the other solutions fixed it.

我也遇到过这个问题,除了它在 Windows 中。我不想完全删除 .metadata 文件夹,其他解决方案都没有修复它。

I managed to fix it by removing the file workspace\.metadata\.plugins\org.eclipse.core.resources\.safetable\org.eclipse.core.resourceswhile Eclipse was closed. The file gets saved when closing Eclipse so I guess it is cached while Eclipse is open.

我设法通过workspace\.metadata\.plugins\org.eclipse.core.resources\.safetable\org.eclipse.core.resources在 Eclipse 关闭时删除文件来修复它。该文件在关闭 Eclipse 时被保存,所以我猜它在 Eclipse 打开时被缓存。

回答by ginger

I am running Eclipse Kepler on OS X Mountain Lion, and I had a similar problem. I deleted a project and tried to recreate it in the same location. Eclipse gave me an error saying that the project already existed. I discovered that if I close Eclipse after deleting a project, then reopen it, Eclipse finally 'forgets' the deleted project and allows me to re-create it.

我在 OS X Mountain Lion 上运行 Eclipse Kepler,我遇到了类似的问题。我删除了一个项目并尝试在同一位置重新创建它。Eclipse 给了我一个错误,说该项目已经存在。我发现如果我在删除项目后关闭 Eclipse,然后重新打开它,Eclipse 最终会“忘记”已删除的项目并允许我重新创建它。

(This question was posted over 1.5 years ago, and I'm guessing that Bruno already tried this and it didn't work. I just want to let others know that this solution worked for me now on Kepler.)

(这个问题是在 1.5 年前发布的,我猜布鲁诺已经尝试过这个,但没有用。我只是想让其他人知道这个解决方案现在在开普勒上对我有用。)

回答by Wojtek Owczarczyk

Go to your workspace folder using some file manager (you can find your workspace location, be clicking File -> Swich Workspace...) and delete your foo folder, or simple remove its contents (.projectfile being most important). Then you should be able to create your new project.

使用一些文件管理器转到您的工作区文件夹(您可以找到您的工作区位置,单击File -> Swich Workspace...)并删除您的 foo 文件夹,或者简单地删除其内容(.project文件是最重要的)。然后你应该能够创建你的新项目。

回答by Bruno Girin

I finally managed to fix it by deleting the workspace/.metadata directory. This resolves the problem but has the side effect of making eclipse forget everything about the workspace so I'm not sure it's a recommended way of fixing the problem.

我终于设法通过删除 workspace/.metadata 目录来修复它。这解决了问题,但具有使 eclipse 忘记有关工作区的所有内容的副作用,因此我不确定这是解决问题的推荐方法。

回答by PetMarion

I had the same problem, with Egit and repositories that I deleted and imported back again, instead of importing as general project choose import as existing project.

我有同样的问题,我删除并再次导入 Egit 和存储库,而不是作为一般项目导入,而是选择作为现有项目导入。

回答by kwang

maybe you can try to delete the folders: "/your_workspace/.metadata/.plugins/org.eclipse.core.resources" "/your_workspace/ProjectName"

也许您可以尝试删除文件夹:“/your_workspace/.metadata/.plugins/org.eclipse.core.resources”“/your_workspace/ProjectName”

回答by Blank Chisui

If the Project was in a working setbefore you deleted it, you might have to manually remove it from the set.

如果项目working set在您删除之前就在 a 中,您可能必须手动将其从集合中删除。