一、遇到的现象:
报错:IDEA Unable to import maven project: See logs for details
( 直接现象: IDEA无法将下载的源码转成maven project,以致于项目缺少相应的包,最终导致项目无法运行!)
二、错误日志:
2020-01-07 13:40:08,540 [1074533] ERROR - #org.jetbrains.idea.maven - IntelliJ IDEA 2019.1.3 Build #IU-191.7479.19 2020-01-07 13:40:08,540 [1074533] ERROR - #org.jetbrains.idea.maven - JDK: 1.8.0_202-release; VM: OpenJDK 64-Bit Server VM; Vendor: JetBrains s.r.o 2020-01-07 13:40:08,540 [1074533] ERROR - #org.jetbrains.idea.maven - OS: Windows 10 2020-01-07 13:40:08,542 [1074535] ERROR - #org.jetbrains.idea.maven - Last Action: Maven.DownloadAllSources 2020-01-07 13:40:08,742 [1074735] INFO - .diagnostic.PerformanceWatcher - Pushing properties took 110ms; general responsiveness: ok; EDT responsiveness: ok 2020-01-07 13:40:08,819 [1074812] INFO - .diagnostic.PerformanceWatcher - Indexable file iteration took 67ms; general responsiveness: ok; EDT responsiveness: ok 2020-01-07 13:40:25,605 [1091598] WARN - ConfigurableExtensionPointUtil - ignore deprecated groupId: language for id: preferences.language.Kotlin.scripting 2020-01-07 13:40:26,080 [1092073] INFO - j.ide.plugins.RepositoryHelper - using cached plugin list (updated at 2020/1/7 12:25) 2020-01-07 13:41:11,038 [1137031] INFO - rationStore.ComponentStoreImpl - Saving Project 'C:\Users\Raodi\Desktop\yinyue\LandCirculationSystem' LandCirculationSystemlibraryTable took 17 ms 2020-01-07 13:41:11,070 [1137063] INFO - mponents.impl.stores.StoreUtil - saveProjectsAndApp took 93 ms 2020-01-07 13:41:12,160 [1138153] INFO - pl.ProjectRootManagerComponent - project roots have changed 2020-01-07 13:41:12,259 [1138252] INFO - indexing.UnindexedFilesUpdater - Unindexed files update canceled 2020-01-07 13:41:12,261 [1138254] INFO - pl.ProjectRootManagerComponent - project roots have changed 2020-01-07 13:41:12,313 [1138306] ERROR - #org.jetbrains.idea.maven - Cannot reconnect. java.lang.RuntimeException: Cannot reconnect. at org.jetbrains.idea.maven.server.RemoteObjectWrapper.perform(RemoteObjectWrapper.java:82) at org.jetbrains.idea.maven.server.MavenServerManager.applyProfiles(MavenServerManager.java:404) at org.jetbrains.idea.maven.project.MavenProjectReader.applyProfiles(MavenProjectReader.java:399) at org.jetbrains.idea.maven.project.MavenProjectReader.doReadProjectModel(MavenProjectReader.java:108) at org.jetbrains.idea.maven.project.MavenProjectReader.readProject(MavenProjectReader.java:67) at org.jetbrains.idea.maven.project.MavenProject.read(MavenProject.java:665) at org.jetbrains.idea.maven.project.MavenProjectsTree.doUpdate(MavenProjectsTree.java:555) at org.jetbrains.idea.maven.project.MavenProjectsTree.doAdd(MavenProjectsTree.java:500) at org.jetbrains.idea.maven.project.MavenProjectsTree.update(MavenProjectsTree.java:461) at org.jetbrains.idea.maven.project.MavenProjectsTree.update(MavenProjectsTree.java:443) at org.jetbrains.idea.maven.project.MavenProjectsProcessorReadingTask.perform(MavenProjectsProcessorReadingTask.java:65) at org.jetbrains.idea.maven.project.MavenProjectsProcessor.doProcessPendingTasks(MavenProjectsProcessor.java:135) at org.jetbrains.idea.maven.project.MavenProjectsProcessor.access$000(MavenProjectsProcessor.java:32) at org.jetbrains.idea.maven.project.MavenProjectsProcessor$2.run(MavenProjectsProcessor.java:109) at org.jetbrains.idea.maven.utils.MavenUtil.lambda$runInBackground$5(MavenUtil.java:458) at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:311) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: java.rmi.RemoteException: Cannot start maven service; nested exception is: com.intellij.execution.ExecutionException at org.jetbrains.idea.maven.server.MavenServerManager.create(MavenServerManager.java:169) at org.jetbrains.idea.maven.server.MavenServerManager.create(MavenServerManager.java:74) at org.jetbrains.idea.maven.server.RemoteObjectWrapper.getOrCreateWrappee(RemoteObjectWrapper.java:41) at org.jetbrains.idea.maven.server.MavenServerManager.lambda$applyProfiles$3(MavenServerManager.java:404) at org.jetbrains.idea.maven.server.RemoteObjectWrapper.perform(RemoteObjectWrapper.java:76) ... 20 more Caused by: com.intellij.execution.ExecutionException at com.intellij.execution.rmi.RemoteProcessSupport.acquire(RemoteProcessSupport.java:144) at org.jetbrains.idea.maven.server.MavenServerManager.create(MavenServerManager.java:166) ... 24 more Caused by: java.lang.AssertionError at org.jetbrains.idea.maven.server.MavenServerManager$MavenServerCMDState.createJavaParameters(MavenServerManager.java:731) at org.jetbrains.idea.maven.server.MavenServerManager$MavenServerCMDState.startProcess(MavenServerManager.java:793) at org.jetbrains.idea.maven.server.MavenServerManager$MavenServerCMDState.execute(MavenServerManager.java:786) at com.intellij.execution.rmi.RemoteProcessSupport.startProcess(RemoteProcessSupport.java:197) at com.intellij.execution.rmi.RemoteProcessSupport.acquire(RemoteProcessSupport.java:124) ... 25 more
三、解决方法
1、重新下载maven (此步建议不做,从第2步骤开始)
在idea中,依次点击“File” -> "Setting .." -> "Plugins" ,在Marketplace中搜索插件,“Maven Integration”和“Maven Integration Extension” ,并安装
2、配置阿里云镜像库和本地库
找到内嵌intellij idea的maven包,首先在系统中找到idea的本地程序的安装目录,建议在idea的快捷方式上一路选择 “打开文件位置”
再返回上一级目录,继续进入“\plugins\maven\lib”路径,如下图,这时会看到intellij idea内嵌的maven
修改“maven3\conf”目录下的settings.xml文件,修改的内容如下:
C:\Users\Raodi\AppData\Local\JetBrains\Toolbox\apps\IDEA-U\ch-0\191.7479.19\plugins\maven\lib\maven3\lib
alimaven aliyun maven http://maven.aliyun.com/nexus/content/groups/public/ central
记得
完整的文件内容:
"1.0" encoding="UTF-8"?>"http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> C:\Users\Raodi\AppData\Local\JetBrains\Toolbox\apps\IDEA-U\ch-0\191.7479.19\plugins\maven\lib\maven3\lib alimaven aliyun maven http://maven.aliyun.com/nexus/content/groups/public/ central
3、设置为intellij idea项目默认maven
依次点击“File” -> "Other Settings" -> "Settings for New Projects.." ,在打开的面板中搜索“maven”
选择“maven”后 ,将“Maven home directory:” 的内容设置为intellij idea安装目录中深藏的maven 的家目录即可,最后重新启动intellij idea即可,如下图: