文章目錄
- 業務場景
- 錯誤提示
- 分析過程
- 解決辦法
業務場景
settings.xml
種配置了私服,但是有些依賴私服上沒有,通過同事拷貝過來的。但是用maven
打包時報紅了。
錯誤提示
Idea Maven錯誤:was cached in the local repository, resolution will not be reattempted until the update
was cached in the local repository, resolution will not be reattempted until the update interval of io.spring.repo.maven.release has elapsed or updates are forced
This failure was cached in the local repository and resolution is not reattempted until the update interval of repo183 has elapsed or updates are forced
[ERROR] Failed to execute goal on project XXX: Could not resolve dependencies for project com.vixtel.project:boce-subscriber:jar:2.1.0-20230908: com.vixtel.vaf:vaf-nacos-config-precheck:jar:2.4.0-20230801 was not found in http://36.134.39.183:4000/repository/maven-public/ during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of repo183 has elapsed or updates are forced
分析過程
- 按照提示,查找本地
repository
中是否有缺失的jar
,但jar
都是有的,同事拷貝的都有jar
文件 - 參考幾篇文章:maven依賴報紅。解決本地有jar包,idea無法加載
_remote.repositories文件的作用
使用Maven管理項目時,明明本地倉庫有對應的jar包,但還是報找不到
快速清理本地倉庫的文件
解釋:maven3.x版本從遠程庫下載依賴后,會生成對應的_remote.repositories
文件,標示該資源的來源。如果你有這個文件_remote.repositories
,那就不會訪問本地了,會去遠程上找。必須遠程上有才行,否則就會報錯。
而我們的私服是沒有依賴的,直接拷貝到的本地。
解決辦法
刪除對應倉庫中的_remote.repositories
文件
如果多可以使用快速清理本地倉庫的文件