eclipse 尝试重新创建项目时“无法在工作区中创建项目内容”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9075849/
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
'Cannot create project content in workspace' when trying to recreate a project
提问by user1158831
I created one project in Eclipse using Existing Source option. Later I found some config problem with it and deleted the project from eclipse keeping the contents of the folder untouched. Now again I tried to create a new project with the same folder as the source folder. But Eclipse is not allowing me to do it and its giving error 'Cannot create project content in workspace'. I checked in the source folder for any .PROJECT files, but none is existing. Do anyone has a solution to this ?
我使用 Existing Source 选项在 Eclipse 中创建了一个项目。后来我发现它有一些配置问题,并从 eclipse 中删除了该项目,保持文件夹的内容不变。现在我再次尝试使用与源文件夹相同的文件夹创建一个新项目。但是 Eclipse 不允许我这样做,并且它给出了错误“无法在工作区中创建项目内容”。我在源文件夹中检查了任何 .PROJECT 文件,但都不存在。有没有人对此有解决方案?
回答by E-Riz
As described by this message on the Eclipse forums, the project location you are selecting is already in your workspace. The "create from existing" feature needs to have the source located outside the workspace. You need to either move the source out of the workspace or create a New project giving the folder containing the project as the project name.
正如Eclipse 论坛上的这条消息所述,您选择的项目位置已经在您的工作区中。“从现有创建”功能需要将源位于工作区之外。您需要将源移出工作区或创建一个新项目,将包含该项目的文件夹作为项目名称。
回答by KillianDS
This is mainly an issue when trying to create a project in a nested sub folder of the workspace. If the project is in a direct sub folder of the workspace folder, just create a new project, use the folder's name as project name and everything will behave like you want to. Otherwise, I used these two solutions without any issue yet, but I think this may depend on which type of project you create (I use mainly pydev, CDT and DLTK):
当尝试在工作区的嵌套子文件夹中创建项目时,这主要是一个问题。如果项目位于工作区文件夹的直接子文件夹中,只需创建一个新项目,使用文件夹的名称作为项目名称,一切都会如您所愿。否则,我使用这两个解决方案没有任何问题,但我认为这可能取决于您创建的项目类型(我主要使用 pydev、CDT 和 DLTK):
- Make a link to the project outside of the workspace directory and import that link. Eclipse does not complain and you can reduce the 'outside' resources to a few symbolic links.
- Create a newstub project, copy all relevant project files (e.g. .buildpath, .project, ...) to the actual project folder. Then delete this stub project and importthe other project, which now works. Note that importing is not the same as
new>create from existing
, it's really a separate import option.
- 在工作区目录之外创建一个指向项目的链接并导入该链接。Eclipse 不会抱怨,您可以将“外部”资源减少到几个符号链接。
- 创建一个新的存根项目,将所有相关的项目文件(例如 .buildpath、.project、...)复制到实际的项目文件夹中。然后删除这个存根项目并导入另一个现在可以工作的项目。请注意,导入与 不同
new>create from existing
,它实际上是一个单独的导入选项。
回答by Greeso
I had a similar problem. I was creating a PHP project in eclipse, in a workspace that has other projects, and for some reason was not able to create it (I think because it is in a sub folder and not in the root folder of the workspace). In anycase, what I ended up doing is the following:
我有一个类似的问题。我在 eclipse 中创建了一个 PHP 项目,在一个有其他项目的工作区中,由于某种原因无法创建它(我认为是因为它在一个子文件夹中而不是在工作区的根文件夹中)。无论如何,我最终做的是以下内容:
In Eclise, create a new project in the root folder of your work space
Still in Eclipse, after the project is created, right click and delete the project, but make sure you do not select the option to delete the files on disk (i.e., keep the files/folders on disk)
Go to your Windows Explorer, and move the project to the location you like to place it at (ie., the location you could not use in the first place).
Back to Eclipse, and this time import the project (impot -> existing project into workspace) and you will have your project there.
在 Eclise 中,在工作空间的根文件夹中创建一个新项目
还是在Eclipse中,项目创建好后,右击删除项目,但一定不要选择删除磁盘上的文件的选项(即保留磁盘上的文件/文件夹)
转到您的 Windows 资源管理器,将项目移动到您想要放置它的位置(即,您最初无法使用的位置)。
回到 Eclipse,这次导入项目(导入 -> 现有项目到工作区),你的项目就会在那里。
回答by Stefan Michev
I had the same issue and here is how i solved it:
我遇到了同样的问题,这是我解决的方法:
1. moved the project folder(named www) outside the workspace folder
2. created new project in the workspace with the same name(www)
3. close eclipse
4. move the external www folder into the workspace folder (e.g. overwrite the new one created within eclipse)
5. open eclipse
6. F5/refresh on the www folder inside the workspace
et voila.
等等。
回答by Edinan William
it works for me: file->import->projects from file system or archive->directory->be happy
它对我有用:文件->导入->来自文件系统或存档的项目->目录->开心