IDEA 报错:Unable to import maven project: See logs for details 解决方法记录

2022-06-10 19:52:45 浏览数 (1)

今天记录一下遇到的问题及解决方法

报错:Unable to import maven project: See logs for details

新项目用IDEA打开时,引入依赖时总是会报错

查看日志

看到报错如下: Unable to create injector, see the following errors

代码语言:javascript复制
2020-04-30 14:37:55,048 [11620846]  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)

网上说 maven 版本不兼容的问题导致,看了下我的 maven 是 3.6.2 的

所以打算换 maven 版本,换到 3.6.0 试试看

  1. 更换 maven

去 apache 官网下载需要的版本 https://maven.apache.org/download.cgi

下载的话选择下方的 archives

选择 3.6.0 版本

选择 binaries/

选择 apache-maven-3.6.0-bin.zip ,然后下载

下载完成之后,修改 IDEA 的 maven 配置

重新 Reimport,无报错!解决~

关于 3.6.2 的版本为什么不兼容,换到低版本就可以了,网上也没具体的说法,我也懒得深究了,如果有需要再深入了解吧。

Copyright: 采用 知识共享署名4.0 国际许可协议进行许可 Links: https://lixj.fun/archives/idea问题解决

0 人点赞