环境
Windows10
jdk1.8
IDEA 2018.3.2
maven3.6.3
问题描述
原本在maven3.3.9和idea2018.3.2环境下开发,因为硬盘问题,重置电脑后,安装了最新版的maven3.6.3,idea还是idea2018.3.2,使用idea导入项目报错:Unable to import maven project: See logs for details,通过查看idea日志(help-->Show Log in Explorer-->打开idea.log ),发现错误:No implementation for org.apache.maven.model.path.PathTranslator was bound. 更多日志如下:
2020-12-13 12:13:53,945 [1275404] ERROR - #org.jetbrains.idea.maven - IntelliJ IDEA 2018.3.2 Build #IU-183.4886.37
2020-12-13 12:13:53,945 [1275404] ERROR - #org.jetbrains.idea.maven - JDK: 1.8.0_152-release; VM: OpenJDK 64-Bit Server VM; Vendor: JetBrains s.r.o
2020-12-13 12:13:53,945 [1275404] ERROR - #org.jetbrains.idea.maven - OS: Windows 10
2020-12-13 12:13:53,961 [1275420] ERROR - #org.jetbrains.idea.maven - Last Action: Maven.UpdateFolders
2020-12-13 12:13:54,055 [1275514] ERROR - #org.jetbrains.idea.maven - com.google.inject.CreationException: Unable to create injector, see the following 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)
原因及解决方法
新版maven3.6.2+的与idea2018.3.2存在版本兼容性问题,idea2019.2.3解决了改问题。
https://*.com/questions/57842143/idea-unable-import-maven-project
查看maven版本
http://maven.apache.org/docs/history.html
解决方法:
方法1. 使用maven3.6.2,升级idea到2019.2.3及以上版本
方法2. 使用idea2018.3.2,降级maven到3.5.2及以下的版本
实践
选用方法2解决,使用idea2018.3.2,重新安装maven3.3.9,重新导入项目,成功!
参考:https://blog.csdn.net/weixin_40633275/article/details/102686611
完成!enjoy it!