事情在 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

uj5u.com熱心網友回復:
2021.3 IDE 版本已將捆綁的 Maven 版本更新為3.8.1. 在此版本中,Mavenhttp默認阻止對存盤庫的訪問。在此之前,Maven 本身已經不再使用 http 存盤庫。
因此,現在需要明確配置 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>
<blocked>false</blocked>
</mirror>
</mirrors>
您還可以查看https://stackoverflow.com/a/67002852/2000323 上的相關討論以了解配置方法。
另一種選擇是在 IDE 中指定較舊的 Maven 版本:設定(macOS 上的首選項)| 構建、執行、部署 | 構建工具 | 馬文 | Maven 主路徑。
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/373062.html
