将现有项目导入eclipse时,Maven root pom.xml标记为红色

时间:2022-02-19 23:11:20

When importing existing maven project into eclipse my root pom.xml is marked red. when i select on the pom.xml the message reads :

将现有maven项目导入eclipse时,我的root pom.xml标记为红色。当我在pom.xml上选择时,消息显示:

Can't import project XYZ from an existing workspace folder

无法从现有工作区文件夹导入项目XYZ

This only happens for the root pom.xml

这只发生在root pom.xml中

Eclipse in use: Luna Service Release 2 (4.4.2) Maven Integration for Eclipse 1.5.2.20150413-2215

正在使用的Eclipse:Luna Service Release 2(4.4.2)Maven Integration for Eclipse 1.5.2.20150413-2215

I have tested with number of different maven projects and in different workspaces.

我已经测试了不同的maven项目和不同的工作区。

Please note this worked before, I have been working on some tutorials and created number of Maven projects with same name and artifact Ids etc. I have deleted all the earlier projects, but could there still be some conflicts ?

请注意这个以前工作过,我一直在研究一些教程并创建了一些具有相同名称和工件ID等的Maven项目。我已经删除了所有早期的项目,但是仍然会有一些冲突吗?

any suggestions will help

任何建议都会有所帮助

3 个解决方案

#1


Yes, You should start your Eclipse Workspace out of the pom.xml folder.

是的,您应该从pom.xml文件夹中启动Eclipse Workspace。

for example: D:\workspace\Project_Name.

例如:D:\ workspace \ Project_Name。

In your Project_Name folder which contains pom.xml.

在包含pom.xml的Project_Name文件夹中。

So you have to select D:\workspace while starting the eclipse.

所以你必须在启动eclipse时选择D:\ workspace。

And now, then import the project called Project_Name as maven project, It will work.

现在,然后导入名为Project_Name的项目作为maven项目,它将起作用。

Hope, it will help !!

希望,它会有所帮助!!

#2


I also came across this same issue. I kept my eclipse workspace name and existing maven project name same and got the error importing pom.xml. Later i opened new workspace with different name which is not matching to the existing maven project and now i could import maven project.

我也遇到过同样的问题。我保持我的eclipse工作区名称和现有maven项目名称相同,并导致导入pom.xml时出错。后来我打开了具有不同名称的新工作区,这与现有的maven项目不匹配,现在我可以导入maven项目。

#3


Solution:

1.Click on Windows tab then Preference(if you are using Eclipse).

1.单击Windows选项卡,然后单击首选项(如果您使用的是Eclipse)。

2.Search for the Workspaces first and remove all of them from list(which you can add later eventually)

2.首先搜索工作区并从列表中删除所有工作区(最后可以添加)

3.Then search for Maven and choose User Setting and check your .m2 path along with the updated setting.xml(meanwhile check the proxy too)

3.然后搜索Maven并选择User Setting并检查.m2路径以及更新的setting.xml(同时检查代理)

4.After that restart your eclipse and import the existing maven project again.

4.之后重启你的eclipse并再次导入现有的maven项目。

I'm 100% percent sure u'll no longer face this issue after that. Good Luck :)

我百分之百肯定你会在那之后不再面对这个问题。祝好运 :)

#1


Yes, You should start your Eclipse Workspace out of the pom.xml folder.

是的,您应该从pom.xml文件夹中启动Eclipse Workspace。

for example: D:\workspace\Project_Name.

例如:D:\ workspace \ Project_Name。

In your Project_Name folder which contains pom.xml.

在包含pom.xml的Project_Name文件夹中。

So you have to select D:\workspace while starting the eclipse.

所以你必须在启动eclipse时选择D:\ workspace。

And now, then import the project called Project_Name as maven project, It will work.

现在,然后导入名为Project_Name的项目作为maven项目,它将起作用。

Hope, it will help !!

希望,它会有所帮助!!

#2


I also came across this same issue. I kept my eclipse workspace name and existing maven project name same and got the error importing pom.xml. Later i opened new workspace with different name which is not matching to the existing maven project and now i could import maven project.

我也遇到过同样的问题。我保持我的eclipse工作区名称和现有maven项目名称相同,并导致导入pom.xml时出错。后来我打开了具有不同名称的新工作区,这与现有的maven项目不匹配,现在我可以导入maven项目。

#3


Solution:

1.Click on Windows tab then Preference(if you are using Eclipse).

1.单击Windows选项卡,然后单击首选项(如果您使用的是Eclipse)。

2.Search for the Workspaces first and remove all of them from list(which you can add later eventually)

2.首先搜索工作区并从列表中删除所有工作区(最后可以添加)

3.Then search for Maven and choose User Setting and check your .m2 path along with the updated setting.xml(meanwhile check the proxy too)

3.然后搜索Maven并选择User Setting并检查.m2路径以及更新的setting.xml(同时检查代理)

4.After that restart your eclipse and import the existing maven project again.

4.之后重启你的eclipse并再次导入现有的maven项目。

I'm 100% percent sure u'll no longer face this issue after that. Good Luck :)

我百分之百肯定你会在那之后不再面对这个问题。祝好运 :)