Intellij 2021.3:更新到 intellij 2021.3 后,Maven 无法解析依赖项

Intellij 2021.3: Maven not able to resolve dependencies after update to intellij 2021.3

在 2021.2 中一切正常,但是当同一个项目在 2021.3 中打开时出现以下错误

http://0.0.0.0/ during a previous attempt. This failure was cached in the local repository and resolution will not be reattempted until the update interval of maven-default-http-blocker has elapsed or updates are forced. Original error: Could not transfer metadata com.domain.sub-domain.project:private-commons:1.0.0-SNAPSHOT/maven-metadata.xml from/to maven-default-http-blocker (http://0.0.0.0/): transfer failed for http://0.0.0.0/com/domain/sub-domain/project/private-repo/1.0.0-SNAPSHOT/maven-metadata.xml
Cannot resolve junit:junit:4.12
Cannot resolve org.apache.camel:camel-test:2.23.0
Cannot resolve com.amazonaws:aws-java-sdk-glacier:1.11.415

2021.3 IDE版本已将捆绑的Maven版本更新为3.8.1。在 this version, Maven blocks the access to http repositories by default. Before that, Maven itself has moved from using the http repositories.

所以现在需要显式配置 Maven 以允许 http 存储库,如果它们在项目中使用的话。例如。在 settings.xml 中向您的 http 存储库添加一个允许 HTTP:

的镜像
<mirrors>
    <mirror>
        <id>my-repo-mirror</id>
        <name>My Repo HTTP Mirror</name>
        <url>http://url-to.my/repo</url>
        <mirrorOf>my-repo</mirrorOf>
    </mirror>
</mirrors>

您也可以查看 的相关讨论以了解配置方法。

另一种选择是在 IDE 中指定较旧的 Maven 版本:设置(macOS 上的首选项)|构建、执行、部署 |构建工具 |行家 | Maven 主路径.