IDEA2019.2.2版本报Unable to import maven project错及解决方法

IDEA2019.2.2版本报Unable to import maven project错及解决方法

一、背景交代

由于工作原因,需要全部重新下载一遍Java的开发工具和相关环境配置。但是在所有的工作安装好,JDK8、IDEA2019.2.2、Maven3.6.2版本装好并配置好(经过测试没有问题),这些软件我使用的当前的最新稳定版本。准备创建一个简单的SpringBoot的项目发现总是报Unable to import maven project错。特此记录下解决过程及思路。

  • JDK8u221
  • IDEA 2019.2.2
  • Maven 3.6.2

二、现象描述

  1. 创建SpringBoot项目后,准备进行以来下载时,发现IDEA报如下错误弹框。

在这里插入图片描述

  1. idea提示我看日志,好,那我就去看看。按照下图方式即可找到日志。

IDEA2019.2.2版本报Unable to import maven project错及解决方法_第1张图片

  1. 错误日志内容
2019-09-20 11:46:45,491 [   9005]   INFO - cloudConfig.CloudConfigManager - === calculateInitStatus.value: JBA_NOT_CONNECTED === 
2019-09-20 11:46:45,492 [   9006]   INFO - cloudConfig.CloudConfigManager - === End.updateInitStatus === 
2019-09-20 11:46:47,798 [  11312]   INFO - ings.impl.UpdateCheckerService - channel: release 
2019-09-20 11:46:58,500 [  22014]   INFO - .diagnostic.PerformanceWatcher - Unindexed files update took 14299ms; general responsiveness: ok; EDT responsiveness: ok 
2019-09-20 11:46:58,501 [  22015]   INFO - tellij.diagnostic.LoadingPhase - Reached INDEXING_FINISHED loading phase 
2019-09-20 11:46:58,515 [  22029]   INFO - cloudConfig.CloudConfigManager - === StatusBar.start another widget: com.intellij.cloudConfig.StatusBarInfoManager$InfoComponent@1e6e941b === 
2019-09-20 11:47:01,413 [  24927]   INFO - CompilerWorkspaceConfiguration - Available processors: 8 
2019-09-20 11:47:06,934 [  30448]   WARN - com.intellij.util.xmlb.Binding - no accessors for class org.jetbrains.kotlin.idea.highlighter.KotlinDefaultHighlightingSettingsProvider 
2019-09-20 11:47:12,746 [  36260]  ERROR -      #org.jetbrains.idea.maven - com.google.inject.CreationException: Unable to create injector, see the following errors:

1) No implementation for org.apache.maven.model.path.PathTranslator was bound.
  while locating org.apache.maven.model.path.PathTranslator
    for field at org.apache.maven.model.interpolation.AbstractStringBasedModelInterpolator.pathTranslator(Unknown Source)
  at org.codehaus.plexus.DefaultPlexusContainer$1.configure(DefaultPlexusContainer.java:350)

2) No implementation for org.apache.maven.model.path.UrlNormalizer was bound.
  while locating org.apache.maven.model.path.UrlNormalizer
    for field at org.apache.maven.model.interpolation.AbstractStringBasedModelInterpolator.urlNormalizer(Unknown Source)
  at org.codehaus.plexus.DefaultPlexusContainer$1.configure(DefaultPlexusContainer.java:350)

2 errors 
java.lang.RuntimeException: com.google.inject.CreationException: Unable to create injector, see the following errors:

1) No implementation for org.apache.maven.model.path.PathTranslator was bound.
  while locating org.apache.maven.model.path.PathTranslator
    for field at org.apache.maven.model.interpolation.AbstractStringBasedModelInterpolator.pathTranslator(Unknown Source)
  at org.codehaus.plexus.DefaultPlexusContainer$1.configure(DefaultPlexusContainer.java:350)

2) No implementation for org.apache.maven.model.path.UrlNormalizer was bound.
  while locating org.apache.maven.model.path.UrlNormalizer
    for field at org.apache.maven.model.interpolation.AbstractStringBasedModelInterpolator.urlNormalizer(Unknown Source)
  at org.codehaus.plexus.DefaultPlexusContainer$1.configure(DefaultPlexusContainer.java:350)

2 errors
	at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:543)
	at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:159)
	at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:106)
	at com.google.inject.Guice.createInjector(Guice.java:87)
	at com.google.inject.Guice.createInjector(Guice.java:69)
	at com.google.inject.Guice.createInjector(Guice.java:59)
	at org.codehaus.plexus.DefaultPlexusContainer.addComponent(DefaultPlexusContainer.java:344)
	at org.codehaus.plexus.DefaultPlexusContainer.addComponent(DefaultPlexusContainer.java:332)
	at org.jetbrains.idea.maven.server.Maven3XServerEmbedder.customizeComponents(Maven3XServerEmbedder.java:573)
	at org.jetbrains.idea.maven.server.Maven3XServerEmbedder.customize(Maven3XServerEmbedder.java:542)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359)
	at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
	at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
	at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562)
	at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796)
	at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)
	at java.rmi/sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:283)
	at java.rmi/sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:260)
	at java.rmi/sun.rmi.server.UnicastRef.invoke(UnicastRef.java:161)
	at java.rmi/java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:209)
	at java.rmi/java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:161)
	at com.sun.proxy.$Proxy152.customize(Unknown Source)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at com.intellij.execution.rmi.RemoteUtil.invokeRemote(RemoteUtil.java:175)
	at com.intellij.execution.rmi.RemoteUtil.access$200(RemoteUtil.java:38)
	at com.intellij.execution.rmi.RemoteUtil$1$1$1.compute(RemoteUtil.java:156)
	at com.intellij.openapi.util.ClassLoaderUtil.computeWithClassLoader(ClassLoaderUtil.java:45)
	at com.intellij.execution.rmi.RemoteUtil.executeWithClassLoader(RemoteUtil.java:227)
	at com.intellij.execution.rmi.RemoteUtil$1$1.invoke(RemoteUtil.java:153)
	at com.sun.proxy.$Proxy152.customize(Unknown Source)
	at org.jetbrains.idea.maven.server.MavenEmbedderWrapper.doCustomize(MavenEmbedderWrapper.java:92)
	at org.jetbrains.idea.maven.server.MavenEmbedderWrapper.onWrappeeCreated(MavenEmbedderWrapper.java:45)
	at org.jetbrains.idea.maven.server.RemoteObjectWrapper.getOrCreateWrappee(RemoteObjectWrapper.java:42)
	at org.jetbrains.idea.maven.server.MavenEmbedderWrapper.doCustomize(MavenEmbedderWrapper.java:92)
	at org.jetbrains.idea.maven.server.MavenEmbedderWrapper.lambda$customizeForResolve$1(MavenEmbedderWrapper.java:65)
	at org.jetbrains.idea.maven.server.RemoteObjectWrapper.perform(RemoteObjectWrapper.java:76)
	at org.jetbrains.idea.maven.server.MavenEmbedderWrapper.customizeForResolve(MavenEmbedderWrapper.java:64)
	at org.jetbrains.idea.maven.project.MavenProjectsTree.resolve(MavenProjectsTree.java:1261)
	at org.jetbrains.idea.maven.project.MavenProjectsProcessorResolvingTask.perform(MavenProjectsProcessorResolvingTask.java:45)
	at org.jetbrains.idea.maven.project.MavenProjectsProcessor.doProcessPendingTasks(MavenProjectsProcessor.java:140)
	at org.jetbrains.idea.maven.project.MavenProjectsProcessor.access$000(MavenProjectsProcessor.java:33)
	at org.jetbrains.idea.maven.project.MavenProjectsProcessor$2.run(MavenProjectsProcessor.java:114)
	at org.jetbrains.idea.maven.utils.MavenUtil.lambda$runInBackground$5(MavenUtil.java:468)
	at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:294)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)
2019-09-20 11:47:12,748 [  36262]  ERROR -      #org.jetbrains.idea.maven - IntelliJ IDEA 2019.2.2  Build #IU-192.6603.28 
2019-09-20 11:47:12,748 [  36262]  ERROR -      #org.jetbrains.idea.maven - JDK: 11.0.3; VM: OpenJDK 64-Bit Server VM; Vendor: JetBrains s.r.o 
2019-09-20 11:47:12,749 [  36263]  ERROR -      #org.jetbrains.idea.maven - OS: Windows 10 
2019-09-20 11:47:12,756 [  36270]  ERROR -      #org.jetbrains.idea.maven - Last Action: Maven.Reimport 
2019-09-20 11:47:15,822 [  39336]   INFO - ide.actions.ShowFilePathAction - 
Exit code 1 
2019-09-20 11:47:16,734 [  40248]   INFO - rationStore.ComponentStoreImpl - Saving Project 'D:\workspaces\idea-workspace\demo' demoRunManager took 33 ms 
2019-09-20 11:47:16,734 [  40248]   INFO - mponents.impl.stores.StoreUtil - saveProjectsAndApp took 218 ms 

反正我是看了半天,也没看出来是什么的原因。于是在网上找了一堆解决方法,发现都不行。因为我之前都是这么配置,从来没有出过问题。于是多想一下,有没有可能是版本之间的兼容问题。于是我看了下Maven3.6.2的发布日期是2019-08-27。而IDEA2019.2.2的发布日期2019年7月(记不得太清了,肯定早于Maven3.6.2的发布日期)则是早于Maven的。于是乎,有极大的可能是版本不兼容的问题。于是我们把Maven换成了Maven3.6.1.,于是项目依赖便神奇的好了,这可真是神坑,应该是IDEA的一个bug。

三、问题解决

  • Maven版本降级(降为3.6.1及以下)
  • 遇到问题多看日志,IDEA给出的日志还是很直观的,不要瞎看网上其他的解决方案(因为有需要时瞎说的,最主要是根据日志进行排查),及排查原因的思路

你可能感兴趣的:(Maven,其他)