An internal error occurred during: “Updating Maven Project”. java.lang.NullPointerException

后端 未结 20 765
小鲜肉
小鲜肉 2020-12-12 16:55

I\'m developing a Java EE web project. When I try to add a dependency, this error message appears. I use Eclipse Kepler.

An internal error occurred du

相关标签:
20条回答
  • 2020-12-12 17:19

    I had this same issue across multiple projects and multiple workspaces, none of the solutions I found online worked for me. I'm using STS and the only thing that worked was to go into my STS directory and add a "-clean" to the top of the STS.ini file. You can then start up your workspace and run maven clean without errors. (you can also remove the -clean tag from the ini file so it doesn't clean everytime you start it)

    Hope this helps someone.

    0 讨论(0)
  • 2020-12-12 17:19

    The root issue in my case was a file conflict in the .settings folder. So, deleting the .settings folder would have resolved the Maven error, but I wanted to keep some of my local configuration files. I resolved the conflict, then tried a Maven update again and it worked.

    0 讨论(0)
  • 2020-12-12 17:19

    In my case, the problem was a conflict of derived dependencies that were been used by other dependencies, and some of those derived dependencies versions were not available, maybe because some deploy that i forgot to do because with workspace resolution everything worked, but when moving to other environment all broke suddenly. And also I was working with version ranges

    maven was giving me this error:

    Could not resolve dependencies for project MyProject:MyProject:jar:1.0.0: Could not resolve version conflict among Dependency-A:1.0.1 -> Dependency-B:1.1.0 -> Dependency-C:1.0.0, Dependency-X:1.0.1 -> Dependency-Y:1.1.0 -> Dependency-C:1.0.0, Dependency-I:1.0.1 -> Dependency-J:1.1.0 -> Dependency-C:1.0.0

    I tried all above and nothing worked, so...

    THE SOLUTION: Use LATEST as version in all dependencies, so maven don't need to resolve all dependencies in ranges, wich must be used with care because if you miss to deploy one of the dependencies the build will fail

    Only I suggest you to use LATEST if you are working with your own dependencies, otherwise in some third party future version, you could find some compilation or runtime errors

    0 讨论(0)
  • 2020-12-12 17:22

    Above solutions did not work for me as the issue with open JDK 13 version https://github.com/spotify/dockerfile-maven/issues/163 So I degraded to open JDK8 and it works for me

    0 讨论(0)
  • 2020-12-12 17:23

    I had the same issue ... solution at the end !

    here the eclipse log:

    java.lang.NullPointerException
        at com.google.appengine.eclipse.wtp.maven.GaeRuntimeManager.getGaeRuntime(GaeRuntimeManager.java:85)
        at com.google.appengine.eclipse.wtp.maven.GaeRuntimeManager.ensureGaeRuntimeWithSdk(GaeRuntimeManager.java:55)
        at com.google.appengine.eclipse.wtp.maven.GaeFacetManager.addGaeFacet(GaeFacetManager.java:59)
        at com.google.appengine.eclipse.wtp.maven.GaeProjectConfigurator.configure(GaeProjectConfigurator.java:46)
    

    ... it comes from "appengine maven wtp plugin" that try to get the type of GAE runtime, but seems to be null here (... getRuntimeType() --> NPE):

    see class com.google.appengine.eclipse.wtp.maven/GaeRuntimeManager.java

      private static IRuntime getGaeRuntime(String sdkVersion) {
        IRuntime[] runtimes = ServerCore.getRuntimes();
        for (IRuntime runtime : runtimes) {
          if (runtime != null &&  **runtime.getRuntimeType()**.equals(GAE_RUNTIME_TYPE)) {
    

    So, if you check in eclipse, Google App Engine is visible , but when you select it you'll see that no SDK is associated ...

    SOLUTION: in red on the screenshot ;-)

    0 讨论(0)
  • 2020-12-12 17:24

    I encountered this same symptom and none of the solutions above were helpful. I finally got a stack trace of the problem by importing the ear project again to eclipse, and was able to trace this down to the org.eclipse.m2e.wtp.MavenDeploymentDescriptorManagement which was trying to delete a directory in windows' temp directory called ".mavenDeploymentDescriptorManagement", which caused an irrational NullPointerException from the java.io.File.exists() method, particularly because the code already had successfully done the same thing in a previous method with the same variable, then called file.isFile() without problem.

    Checking this out on the file system revealed that the file could only be accessed with administrator privileges. Apparently I had at some point launched eclipse from an administrator console by mistake. In the end I just made hidden files visible in windows explorer and deleted the temporary file manually, which solved the problem.

    0 讨论(0)
提交回复
热议问题