eclipse 在“更新 Maven 项目”期间发生内部错误。java.lang.NullPointerException
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19522897/
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
An internal error occurred during: "Updating Maven Project". java.lang.NullPointerException
提问by achref05
I'm developing a Java EE web project. When I try to add a dependency, this error message appears. I use Eclipse Kepler.
我正在开发一个 Java EE Web 项目。当我尝试添加依赖项时,会出现此错误消息。我使用 Eclipse 开普勒。
An internal error occurred during: "Updating Maven Project". java.lang.NullPointerException
在“更新 Maven 项目”期间发生内部错误。java.lang.NullPointerException
Could you help me? Thank you.
你可以帮帮我吗?谢谢你。
回答by user2985381
I solved mine by deleting the .settings
folder and .project
file in the project and then reimporting the project.
我通过删除项目中的.settings
文件夹和.project
文件然后重新导入项目来解决我的问题。
回答by Eel Lee
For me worked the answer I found on CodeRanch, by user Maneesh Godbole:
对我来说,我在CodeRanch 上找到了答案 ,由用户Maneesh Godbole 提供:
- Close eclipse.
- Navigate to your "workspace" folder
- Ensure the setting on your OS to view hidden files is turned on
- Identify and delete the .metadata directory
- Restart eclipse
- Import project
- 关闭日食。
- 导航到您的“工作区”文件夹
- 确保您的操作系统上查看隐藏文件的设置已打开
- 识别并删除 .metadata 目录
- 重启日食
- 导入项目
回答by user1854278
I've had the same problem in one of my modules.
我在我的一个模块中遇到了同样的问题。
Running "mvn eclipse:eclipse" in the console/cmd solved the problem for me.
在控制台/cmd 中运行“mvn eclipse:eclipse”为我解决了这个问题。
回答by MarnixKlooster ReinstateMonica
In our instance of this problem, we had pom.xml
files where the m2e-specific life cycle mapping configuration
在我们这个问题的实例中,我们有pom.xml
文件,其中特定于 m2e 的生命周期映射配置
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
...
did not have the <version>1.0.0</version>
part. When doing a Maven -> Update Project..., this causes the reported NullPointerException without a stack trace. When using a fresh Import... -> Existing Maven Projects, the same exception occurred, but with a stack trace that led me to find the above.
没有那个<version>1.0.0</version>
部分。在执行 Maven -> Update Project... 时,这会导致报告的 NullPointerException 没有堆栈跟踪。当使用新的 Import... -> Existing Maven Projects 时,发生了同样的异常,但堆栈跟踪导致我找到了上述内容。
(This is with m2e 1.6.1.20150625-2338 in Eclipse Luna Service Release 2 (4.4.2).)
(这是 Eclipse Luna Service Release 2 (4.4.2) 中的 m2e 1.6.1.20150625-2338。)
回答by ccellist
In case it helps anyone, in addition to deleting .settings
and .project
, I had to delete .classpath
and .factorypath
before being able to import the project successfully into Eclipse.
如果它对任何人有帮助,除了删除.settings
and 之外.project
,我还必须删除.classpath
and.factorypath
才能将项目成功导入到 Eclipse 中。
回答by Jyoti Prakash
org.eclipse.m2e.core.prefsfile is in .settingsfolder. If you face the problem of
org.eclipse.m2e.core.prefs文件位于.settings文件夹中。如果您面临以下问题
An internal error occurred during: "Updating Maven Project". java.lang.NullPointerException
An internal error occurred during: "Updating Maven Project". java.lang.NullPointerException
Delete the project from eclipse then by deleting the .settingsfolder & .projectfile in the project -> then re-import the project.
从 eclipse 中删除项目,然后删除项目中的.settings文件夹和.project文件 -> 然后重新导入项目。
回答by Tony
This helped me: Project menu -> Clean... -> clean all projects
这帮助了我: Project menu -> Clean... -> clean all projects
回答by huttraeger
deleting the local maven repository helped me
删除本地 Maven 存储库对我有帮助
回答by user1050755
Eclipse has an error log. There you will see the complete stack trace. In my case it seems to be caused by a bad jar file combined with the java.util.zip libs not throwing a proper exception, just a NullPointerException.
Eclipse 有一个错误日志。在那里您将看到完整的堆栈跟踪。在我的情况下,它似乎是由一个坏的 jar 文件和 java.util.zip 库结合引起的,没有抛出正确的异常,只是一个 NullPointerException。
回答by Jones Michael
I'm using:
我正在使用:
Eclipse Java EE IDE for Web Developers.
面向 Web 开发人员的 Eclipse Java EE IDE。
Version: Neon.3 Release (4.6.3) Build id: 20170314-1500
版本:Neon.3 Release (4.6.3) 版本号:20170314-1500
The fix/trick for me was deleting my local repository in ~/.m2/repository in order to remove local dependencies and rebuilding my project in which fresh dependencies are pulled down.
我的修复/技巧是删除我在 ~/.m2/repository 中的本地存储库,以删除本地依赖项并重建我的项目,其中拉下新的依赖项。