Eclipse:错误”。重叠另一个项目的位置。“在尝试创建新项目时。”

时间:2023-01-24 14:05:37

can anyone help. I keep getting an error message in eclipse when creating a new project and i don't understand why.

谁能帮助。在创建新项目时,我在eclipse中不断收到错误消息,我不明白为什么。

I have created a workspace at the level

我在这个级别上创建了一个工作区

C:\Users\Martin\Java\Counter

C:\Users\Martin\Java\Counter

Inside Counter there are no files but there is a directory called counter_src which contains source files for the project Counter

在计数器中没有文件,但是有一个名为counter_src的目录,其中包含项目计数器的源文件

So in eclipse I do, new java project, and then uncheck default location and choose the directory

因此,在eclipse中,我使用新的java项目,然后取消默认位置,并选择目录

counter_src (which is one level down from Counter)

counter_src(来自于计数器的一个级别)

but it now displays

但现在显示

C:\Users\Martin\Java\Counter\counter_src overlaps the location of another project: 'counter_src'

C:\Users\Martin\Java\Counter\ counter_src重叠的位置,另一个项目:“counter_src”

Now if i create my workspace at

现在,如果我在

C:\Users\Martin\Java\

C:\Users\Martin\Java\

which means my counter_src is actually 2 levels down then it allows me, but the problem is that the directory JAVA contains lots of projects so i wanted to create the workspace in Counter (which has no files) which has subdirectory of counter_src where my source files are.

这意味着我的counter_src实际上是向下两层的,它允许我这么做,但问题是这个目录JAVA包含了很多项目,所以我想在Counter(它没有文件)中创建工作空间,它有counter_src的子目录,我的源文件在那里。

Also tested creating directory off of C:\Users\Martin\Java\ and it appears to work also but I didn't want to create another subdirectory off of "C:\Users\Martin\Java\" just to store my workspace for 1 project.

还测试了创建目录的C:\Users\Martin\Java\也似乎工作但我不想创建另一个的子目录”马丁C:\用户\ \ Java \”只是存储我的工作区1项目。

I would really appreciate any help on this, i am a little list.

非常感谢您的帮助,我是一个小列表。

Thnaks in advance

Thnaks提前

11 个解决方案

#1


83  

Eclipse is erroring because if you try and create a project on a directory that exists, Eclipse doesn't know if it's an actual project or not - so it errors, saving you from losing work!

Eclipse是错误的,因为如果您试图在存在的目录上创建一个项目,Eclipse不知道它是否是一个实际的项目——因此它会出错,从而避免您丢失工作!

So you have two solutions:

所以你有两个解:

  1. Move the folder 'counter_src' somewhere else, then create the project (which will create the directory), then import the source files back into the newly created 'counter_src'.

    将文件夹“counter_src”移到其他地方,然后创建项目(将创建目录),然后将源文件导入新创建的“counter_src”。

  2. Right-click on the project explorer and import an existing project, select C:\Users\Martin\Java\Counter\ as your root directory. If Eclipse sees a project, you will be able to import it.

    右键点击project explorer和导入现有的项目,选择C:\Users\Martin\Java\Counter\作为你的根目录。如果Eclipse看到一个项目,您将能够导入它。

#2


91  

So, I was having the same issue, but trying to import Android code via the "Import..." menu. When neither of the above two solutions worked on Eclipse Juno:

所以,我也遇到了同样的问题,但是我试图通过“导入…”菜单导入Android代码。当以上两种解决方案都不能用于Eclipse Juno时:

  • Eclipse -> File -> Import -> General -> Existing Project Into Workspace (NOTE: NOT 'EXISTING ANDROID PROJECT')

    Eclipse ->文件->导入->通用->现有项目进入工作空间(注意:不是“现有ANDROID项目”)

  • (Projects should import correctly, but should have errors. We must now attach the SDK to the project)

    (项目应该正确导入,但应该有错误。我们现在必须将SDK附加到项目上)

  • Right-Click on the project, Properties->Android->Project Build Target Choose the appropriate build target (in doubt, use 4.0.3 in the project is newish, and use 2.2 if the project is oldish)

    右键单击项目,属性->Android->项目构建目标选择合适的构建目标(在怀疑中使用4.0.3,如果项目是oldish,则使用2.2)

  • Click OK

    单击OK

Once the project rebuilds, everything should be back in order.

一旦项目重新构建,一切都应该恢复正常。

(This was written when Eclipse Indigo was in vogue, and there may be changes as Google updates their tools to cover corner cases.)

(这是在Eclipse Indigo流行的时候编写的,随着谷歌更新他们的工具以覆盖角落的案例,可能会有一些变化。)

#3


28  

Your have dropped the Project in your workspace, and then trying to import it, thats the problem.

您已经将项目放在您的工作区中,然后尝试导入它,这就是问题所在。

This has 2 solution.

这有2个解决方案。

1. More your project folder outside your workspace in some other location and then try.

1。更多的项目文件夹在您的工作区之外的其他地方,然后尝试。

2. Go to File ---> new Project ---> Seleclt the existing project radio button ---> browse to the project folder in your workspace ---> finish

2。点击文件--->新项目---> Seleclt现有项目单选按钮--->浏览到你工作区的项目文件夹--->完成。

/////////////////EDITED/////////////////

/ / / / / / / / / / / / / / / / /编辑/ / / / / / / / / / / / / / / / /

Assume D:\MyDirectory\MyWorkSpace - Path of your WorkSpace

假设D:\MyDirectory MyWorkSpace -您的工作区路径

Drop your project which you want to import in Eclipse in MyDirectory folder Not in MyWorkSpace, and try.

将要在Eclipse中导入的项目放在MyDirectory文件夹中而不是MyWorkSpace中,然后尝试。

#4


22  

In my case checking the check-box

在我的情况下,检查复选框

"Copy project into workspace"

“将项目复制到工作区”

did the trick.

起了作用。

#5


3  

simply "CUT" project folder and move it out of workspace directory and do the following

只需“剪切”项目文件夹并将其移出工作区目录,然后执行以下操作

file=>import=>(select new directory)=> mark (copy to my workspace) checkbox 

and you done !

和你做的!

#6


2  

This too took me sometime to figure out.

这也花了我一段时间来弄明白。

Solution:

解决方案:

To create a new Maven Project under the existing workspace, just have the "Use default Workspace location" ticked (Ignore what is in the grayed out location text input).

要在现有的工作空间下创建一个新的Maven项目,只需使用“使用默认工作空间位置”(忽略在灰色的位置文本输入中是什么)。

The name of the project will be determined by you Artifact Id in step 2 of the creation wizard.

项目的名称将由创建向导的第2步中的工件Id决定。

Reasoning:

推理:

It was so confusing because in my case, because when I selected to create a new Maven Project: the default workspace loaction is ticked and directly proceeding it is the grayed out "Location" text input had the workspace location + the existing project I was looking at before choose to create a new Maven Project. (ie: Location = '[workspace path]/last looked at project')

这是如此让人摸不着头脑,因为在我的例子中,因为当我选择创建一个新的Maven项目:默认工作区loaction是自责和直接进行灰色的“位置”文本输入工作区位置+现有项目之前我看着选择创建一个新的Maven项目。(例如:Location = '[workspace path]/last look at project')

So I unticked the default workspace location box and entered in '[workspace path]/new project', which didn't work because eclipse expects the [workspace path] to be different compared to the default path. (Otherwise we would of selected the default workspace check box).

因此,我取消了默认工作区位置框,并输入了'[workspace path]/new project',这并没有起作用,因为eclipse希望[workspace path]与默认路径不同。(否则我们将选择默认的工作区复选框)。

#7


1  

In my case clicking the checkbox for 'import project into workspace' fixed the error, even though the project was already in the workspace folder and didn't actually get moved their by eclipse.

在我的例子中,单击“导入项目到工作区”的复选框修复了错误,尽管该项目已经在工作区文件夹中,实际上并没有被eclipse移动。

#8


0  

FWIW:

就其价值而言:

Neither of the other suggestions worked for me. I had previously created a project with the same name which I then deleted. I recreated the base source-files (using PhoneGap) - which doesn't create the "eclipse"-project. I then tried to create an Android project using existing source files, but it failed with the same error message as the original question implies.

其他的建议对我都不起作用。我之前创建了一个同名的项目,然后删除了它。我重新创建了基本的源文件(使用PhoneGap)—它不创建“eclipse”—项目。然后,我尝试使用现有的源文件创建一个Android项目,但它失败了,错误消息与最初的问题相同。

The solution for me was to move the source-folder and files out of the workspace, and use the same option, but this time check the option for copying the files into the workspace in the wizard.

我的解决方案是将源文件夹和文件从工作区中移出,并使用相同的选项,但是这次检查将文件复制到向导中的工作区中的选项。

#9


0  

I know this is older, but wanted to contribute another possibly solution.

我知道这是一个古老的问题,但我想提出另一个可能的解决方案。

If you want to keep the project location, as I did, I found that copying the .project file from another project into the project's directory, then editing the .project file to name it properly, then choosing the Import Existing Projects into Workspace option worked for me.

如果您想保持项目位置,就像我所做的那样,我发现将另一个项目的.project文件复制到项目的目录中,然后编辑.project文件对其进行适当的命名,然后选择将现有项目导入到Workspace选项中。

In Windows, I used a file monitor to see what Eclipse was doing, and it was simply erroring out for some unknown reason when trying to create the .project file. So, I did that manually and it worked for me.

在Windows中,我使用了一个文件监视器来查看Eclipse在做什么,在尝试创建.project文件时,它只是因为未知的原因而出错。我手工做的,它对我有用。

#10


0  

Go to the actual FILE menu and create a new general project.

转到实际的文件菜单并创建一个新的通用项目。

If the project type isn't recognized, preventing one of these import methods from working, then try this. Once you add the generic project, you can then add support for whatever language you require.

如果项目类型不被识别,阻止其中一个导入方法工作,那么尝试这个方法。一旦添加了通用项目,就可以添加对所需语言的支持。

#11


0  

I got this error when trying to create a new Eclipse project inside a newly cloned Git repo folder.

我在尝试在新克隆的Git repo文件夹中创建一个新的Eclipse项目时遇到了这个错误。

This worked for me:

这工作对我来说:

1) clone the Git repo (in my case it was to a subfolder of the Eclipse default workspace)

1)克隆Git repo(在我的例子中,它是Eclipse默认工作空间的子文件夹)

2) create the new Eclipse project in the default workspace (one level above the cloned Git repo folder)

2)在默认工作区中创建新的Eclipse项目(在克隆的Git repo文件夹之上的一个级别)

3) export the new Eclipse project from the default workspace to the cloned repo directory:

3)将新的Eclipse项目从默认工作区导出到克隆的repo目录:

a) right click on project --> Export --> General --> File System
b) select the new Eclipse project
c) set the destination directory to export to (as the Git repo folder)

4) remove the Eclipse project form the workspace (because it's still the one that uses the default workspace)

4)从工作区中删除Eclipse项目(因为它仍然使用默认工作区)

right click on project and select "Delete"

5) open the exported Eclipse project from inside the Git repo directory

5)从Git repo目录中打开导出的Eclipse项目

a) File --> Open Project from File System or Archive
b) set the "Import source" folder as the Git repo folder
c) check the project to import (that you just exported there)

#1


83  

Eclipse is erroring because if you try and create a project on a directory that exists, Eclipse doesn't know if it's an actual project or not - so it errors, saving you from losing work!

Eclipse是错误的,因为如果您试图在存在的目录上创建一个项目,Eclipse不知道它是否是一个实际的项目——因此它会出错,从而避免您丢失工作!

So you have two solutions:

所以你有两个解:

  1. Move the folder 'counter_src' somewhere else, then create the project (which will create the directory), then import the source files back into the newly created 'counter_src'.

    将文件夹“counter_src”移到其他地方,然后创建项目(将创建目录),然后将源文件导入新创建的“counter_src”。

  2. Right-click on the project explorer and import an existing project, select C:\Users\Martin\Java\Counter\ as your root directory. If Eclipse sees a project, you will be able to import it.

    右键点击project explorer和导入现有的项目,选择C:\Users\Martin\Java\Counter\作为你的根目录。如果Eclipse看到一个项目,您将能够导入它。

#2


91  

So, I was having the same issue, but trying to import Android code via the "Import..." menu. When neither of the above two solutions worked on Eclipse Juno:

所以,我也遇到了同样的问题,但是我试图通过“导入…”菜单导入Android代码。当以上两种解决方案都不能用于Eclipse Juno时:

  • Eclipse -> File -> Import -> General -> Existing Project Into Workspace (NOTE: NOT 'EXISTING ANDROID PROJECT')

    Eclipse ->文件->导入->通用->现有项目进入工作空间(注意:不是“现有ANDROID项目”)

  • (Projects should import correctly, but should have errors. We must now attach the SDK to the project)

    (项目应该正确导入,但应该有错误。我们现在必须将SDK附加到项目上)

  • Right-Click on the project, Properties->Android->Project Build Target Choose the appropriate build target (in doubt, use 4.0.3 in the project is newish, and use 2.2 if the project is oldish)

    右键单击项目,属性->Android->项目构建目标选择合适的构建目标(在怀疑中使用4.0.3,如果项目是oldish,则使用2.2)

  • Click OK

    单击OK

Once the project rebuilds, everything should be back in order.

一旦项目重新构建,一切都应该恢复正常。

(This was written when Eclipse Indigo was in vogue, and there may be changes as Google updates their tools to cover corner cases.)

(这是在Eclipse Indigo流行的时候编写的,随着谷歌更新他们的工具以覆盖角落的案例,可能会有一些变化。)

#3


28  

Your have dropped the Project in your workspace, and then trying to import it, thats the problem.

您已经将项目放在您的工作区中,然后尝试导入它,这就是问题所在。

This has 2 solution.

这有2个解决方案。

1. More your project folder outside your workspace in some other location and then try.

1。更多的项目文件夹在您的工作区之外的其他地方,然后尝试。

2. Go to File ---> new Project ---> Seleclt the existing project radio button ---> browse to the project folder in your workspace ---> finish

2。点击文件--->新项目---> Seleclt现有项目单选按钮--->浏览到你工作区的项目文件夹--->完成。

/////////////////EDITED/////////////////

/ / / / / / / / / / / / / / / / /编辑/ / / / / / / / / / / / / / / / /

Assume D:\MyDirectory\MyWorkSpace - Path of your WorkSpace

假设D:\MyDirectory MyWorkSpace -您的工作区路径

Drop your project which you want to import in Eclipse in MyDirectory folder Not in MyWorkSpace, and try.

将要在Eclipse中导入的项目放在MyDirectory文件夹中而不是MyWorkSpace中,然后尝试。

#4


22  

In my case checking the check-box

在我的情况下,检查复选框

"Copy project into workspace"

“将项目复制到工作区”

did the trick.

起了作用。

#5


3  

simply "CUT" project folder and move it out of workspace directory and do the following

只需“剪切”项目文件夹并将其移出工作区目录,然后执行以下操作

file=>import=>(select new directory)=> mark (copy to my workspace) checkbox 

and you done !

和你做的!

#6


2  

This too took me sometime to figure out.

这也花了我一段时间来弄明白。

Solution:

解决方案:

To create a new Maven Project under the existing workspace, just have the "Use default Workspace location" ticked (Ignore what is in the grayed out location text input).

要在现有的工作空间下创建一个新的Maven项目,只需使用“使用默认工作空间位置”(忽略在灰色的位置文本输入中是什么)。

The name of the project will be determined by you Artifact Id in step 2 of the creation wizard.

项目的名称将由创建向导的第2步中的工件Id决定。

Reasoning:

推理:

It was so confusing because in my case, because when I selected to create a new Maven Project: the default workspace loaction is ticked and directly proceeding it is the grayed out "Location" text input had the workspace location + the existing project I was looking at before choose to create a new Maven Project. (ie: Location = '[workspace path]/last looked at project')

这是如此让人摸不着头脑,因为在我的例子中,因为当我选择创建一个新的Maven项目:默认工作区loaction是自责和直接进行灰色的“位置”文本输入工作区位置+现有项目之前我看着选择创建一个新的Maven项目。(例如:Location = '[workspace path]/last look at project')

So I unticked the default workspace location box and entered in '[workspace path]/new project', which didn't work because eclipse expects the [workspace path] to be different compared to the default path. (Otherwise we would of selected the default workspace check box).

因此,我取消了默认工作区位置框,并输入了'[workspace path]/new project',这并没有起作用,因为eclipse希望[workspace path]与默认路径不同。(否则我们将选择默认的工作区复选框)。

#7


1  

In my case clicking the checkbox for 'import project into workspace' fixed the error, even though the project was already in the workspace folder and didn't actually get moved their by eclipse.

在我的例子中,单击“导入项目到工作区”的复选框修复了错误,尽管该项目已经在工作区文件夹中,实际上并没有被eclipse移动。

#8


0  

FWIW:

就其价值而言:

Neither of the other suggestions worked for me. I had previously created a project with the same name which I then deleted. I recreated the base source-files (using PhoneGap) - which doesn't create the "eclipse"-project. I then tried to create an Android project using existing source files, but it failed with the same error message as the original question implies.

其他的建议对我都不起作用。我之前创建了一个同名的项目,然后删除了它。我重新创建了基本的源文件(使用PhoneGap)—它不创建“eclipse”—项目。然后,我尝试使用现有的源文件创建一个Android项目,但它失败了,错误消息与最初的问题相同。

The solution for me was to move the source-folder and files out of the workspace, and use the same option, but this time check the option for copying the files into the workspace in the wizard.

我的解决方案是将源文件夹和文件从工作区中移出,并使用相同的选项,但是这次检查将文件复制到向导中的工作区中的选项。

#9


0  

I know this is older, but wanted to contribute another possibly solution.

我知道这是一个古老的问题,但我想提出另一个可能的解决方案。

If you want to keep the project location, as I did, I found that copying the .project file from another project into the project's directory, then editing the .project file to name it properly, then choosing the Import Existing Projects into Workspace option worked for me.

如果您想保持项目位置,就像我所做的那样,我发现将另一个项目的.project文件复制到项目的目录中,然后编辑.project文件对其进行适当的命名,然后选择将现有项目导入到Workspace选项中。

In Windows, I used a file monitor to see what Eclipse was doing, and it was simply erroring out for some unknown reason when trying to create the .project file. So, I did that manually and it worked for me.

在Windows中,我使用了一个文件监视器来查看Eclipse在做什么,在尝试创建.project文件时,它只是因为未知的原因而出错。我手工做的,它对我有用。

#10


0  

Go to the actual FILE menu and create a new general project.

转到实际的文件菜单并创建一个新的通用项目。

If the project type isn't recognized, preventing one of these import methods from working, then try this. Once you add the generic project, you can then add support for whatever language you require.

如果项目类型不被识别,阻止其中一个导入方法工作,那么尝试这个方法。一旦添加了通用项目,就可以添加对所需语言的支持。

#11


0  

I got this error when trying to create a new Eclipse project inside a newly cloned Git repo folder.

我在尝试在新克隆的Git repo文件夹中创建一个新的Eclipse项目时遇到了这个错误。

This worked for me:

这工作对我来说:

1) clone the Git repo (in my case it was to a subfolder of the Eclipse default workspace)

1)克隆Git repo(在我的例子中,它是Eclipse默认工作空间的子文件夹)

2) create the new Eclipse project in the default workspace (one level above the cloned Git repo folder)

2)在默认工作区中创建新的Eclipse项目(在克隆的Git repo文件夹之上的一个级别)

3) export the new Eclipse project from the default workspace to the cloned repo directory:

3)将新的Eclipse项目从默认工作区导出到克隆的repo目录:

a) right click on project --> Export --> General --> File System
b) select the new Eclipse project
c) set the destination directory to export to (as the Git repo folder)

4) remove the Eclipse project form the workspace (because it's still the one that uses the default workspace)

4)从工作区中删除Eclipse项目(因为它仍然使用默认工作区)

right click on project and select "Delete"

5) open the exported Eclipse project from inside the Git repo directory

5)从Git repo目录中打开导出的Eclipse项目

a) File --> Open Project from File System or Archive
b) set the "Import source" folder as the Git repo folder
c) check the project to import (that you just exported there)