Eclipse 无法导入 Maven 项目
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28054929/
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
Eclipse fails to import Maven project
提问by Michael Osofsky
I tried to import a multi-module Maven project into Eclipse using the option "Existing Maven Project" from the Import menu.
我尝试使用“导入”菜单中的“现有 Maven 项目”选项将多模块 Maven 项目导入 Eclipse。
I got this error:
我收到此错误:
Could not update project nbsocialmetrics-frontend configuration
java.lang.NullPointerException
In the problems pane I saw this error:
在问题窗格中,我看到了这个错误:
Project configuration is not up-to-date with pom.xml.
Run Maven->Update Project or use Quick Fix. nbsocialmetrics-backend line 1 Maven Configuration Problem
However when I ran Maven->Update Project I just kept getting this error:
但是,当我运行 Maven->Update Project 时,我一直收到此错误:
Unable to update Maven configuration
Could not update project nbsocialmetrics-frontend configuration
java.lang.NullPointerException
Could not update project nbsocialmetrics-backend configuration
java.lang.NullPointerException
The last repository checkin on this project had no issues so I can't figure out why Eclipse won't import it.
这个项目的最后一个存储库签入没有问题,所以我不明白为什么 Eclipse 不会导入它。
回答by Michael Osofsky
Here's how I resolved the problem:
这是我解决问题的方法:
Deleted the imported project from Eclipse (but did not remove from disk).
Exited Eclipse
Deleted the project's
.settings
directoryDeleted the projects's
.project
directoryDeleted the workspace's
.metadata
directoryRestarted Eclipse
Imported the Maven project again by using the option "Existing Maven Project" from the Import menu
从 Eclipse 中删除了导入的项目(但没有从磁盘中删除)。
退出日食
删除项目
.settings
目录删除项目
.project
目录删除工作区的
.metadata
目录重启 Eclipse
使用“导入”菜单中的“现有 Maven 项目”选项再次导入 Maven 项目
This resolved the problem.
这解决了问题。
回答by kirenpillay
Adding the following maven-jar-plugin to the pom.xml fixes this problem. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=516887
将以下 maven-jar-plugin 添加到 pom.xml 可以解决此问题。见 https://bugs.eclipse.org/bugs/show_bug.cgi?id=516887
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
</plugin>
</plugins>
</build>