maven下載依賴失敗問題及解決
前情提要
由于特殊原因,官方maven庫經(jīng)常連接失敗,所以很多maven都配置了阿里云的鏡像。
但是阿里云的鏡像里有很多依賴都沒有,這時候如果你的項目需要這些依賴,就會導(dǎo)致編譯失敗。
1. 問題1
描述:
This failure was cached in the local repository and resolution is not reattempted until the update interval of aliyunmaven has elapsed or updates are forced
詳細:
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Detecting the operating system and CPU architecture
[INFO] ------------------------------------------------------------------------
[INFO] os.detected.name: windows
[INFO] os.detected.arch: x86_64
[INFO] os.detected.classifier: windows-x86_64
[INFO]
[INFO] -------< org.apache.pulsar:kafka-connect-avro-converter-shaded >--------
[INFO] Building Apache Pulsar :: Kafka Connect Avro Converter shaded 2.8.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.415 s
[INFO] Finished at: 2021-10-21T09:22:45+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project kafka-connect-avro-converter-shaded: Could not resolve dependencies for project org.apache.pulsar:kafka-connect-avro-converter-shaded:jar:2.8.0: Failed to collect dependencies at io.confluent:kafka-connect-avro-converter:jar:5.3.2: Failed to read artifact descriptor for io.confluent:kafka-connect-avro-converter:jar:5.3.2: io.confluent:kafka-schema-registry-parent:pom:5.3.2 was not found in https://maven.aliyun.com/repository/public during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of aliyunmaven has elapsed or updates are forced -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
2. 問題2
描述:
Could not find artifact io.confluent:kafka-connect-avro-converter:jar:5.3.2 in aliyunmaven
The POM for io.confluent:kafka-connect-avro-converter:jar:5.3.2 is missing, no dependency information available
詳細:
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Detecting the operating system and CPU architecture
[INFO] ------------------------------------------------------------------------
[INFO] os.detected.name: windows
[INFO] os.detected.arch: x86_64
[INFO] os.detected.classifier: windows-x86_64
[INFO]
[INFO] -------< org.apache.pulsar:kafka-connect-avro-converter-shaded >--------
[INFO] Building Apache Pulsar :: Kafka Connect Avro Converter shaded 2.8.0
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The POM for io.confluent:kafka-connect-avro-converter:jar:5.3.2 is missing, no dependency information available
Downloading from aliyunmaven: https://maven.aliyun.com/repository/public/io/confluent/kafka-connect-avro-converter/5.3.2/kafka-connect-avro-converter-5.3.2.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.427 s
[INFO] Finished at: 2021-10-21T10:39:36+08:00
[INFO] ------------------------------------------------------------------------
[WARNING] The requested profile "confluent" could not be activated because it does not exist.
[ERROR] Failed to execute goal on project kafka-connect-avro-converter-shaded: Could not resolve dependencies for project org.apache.pulsar:kafka-connect-avro-converter-shaded:jar:2.8.0: Could not find artifact io.confluent:kafka-connect-avro-converter:jar:5.3.2 in aliyunmaven (https://maven.aliyun.com/repository/public) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
3. 原因分析
雖然阿里云不存在這個jar包,但我們手動放到了maven的本地庫中,重新打包后還是提示抄不到pom文件。
如下:
猜測可能是lastUpdate的問題,但是刪除后仍然不能成功。
經(jīng)過各種嘗試,下面方法可行。
4. 解決辦法
刪除_remote.repositories和pom文件。
4.1 原始狀態(tài)
目錄文件:
錯誤日志:
[WARNING] The requested profile "confluent" could not be activated because it does not exist.
[ERROR] Failed to execute goal on project kafka-connect-avro-converter-shaded: Could not resolve dependencies for project org.apache.pulsar:kafka-connect-avro-converter-shaded:jar:2.8.0: io.confluent:kafka-connect-avro-converter:jar:5.3.2 was not found in https://maven.aliyun.com/repository/public during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of aliyunmaven has elapsed or updates are forced -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
4.2 刪除_remote.repositories
目錄結(jié)構(gòu):
錯誤日志:
[WARNING] The requested profile "confluent" could not be activated because it does not exist.
[ERROR] Failed to execute goal on project kafka-connect-avro-converter-shaded: Could not resolve dependencies for project org.apache.pulsar:kafka-connect-avro-converter-shaded:jar:2.8.0: Failed to collect dependencies at io.confluent:kafka-connect-avro-converter:jar:5.3.2: Failed to read artifact descriptor for io.confluent:kafka-connect-avro-converter:jar:5.3.2: io.confluent:kafka-schema-registry-parent:pom:5.3.2 was not found in https://maven.aliyun.com/repository/public during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of aliyunmaven has elapsed or updates are forced -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
4.3 刪除pom文件
目錄結(jié)構(gòu):
錯誤日志:
[INFO] Replacing original artifact with shaded artifact.
[INFO] Replacing F:\code\tmp\pulsar\kafka-connect-avro-converter-shaded\target\kafka-connect-avro-converter-shaded.jar with F:\code\tmp\pulsar\kafka-connect-avro-converter-shaded\target\kafka-connect-avro-converter-shaded-2.8.0-shaded.jar
[INFO] Dependency-reduced POM written at: F:\code\tmp\pulsar\kafka-connect-avro-converter-shaded\dependency-reduced-pom.xml
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12.882 s
[INFO] Finished at: 2021-10-21T16:21:55+08:00
[INFO] ------------------------------------------------------------------------
[WARNING] The requested profile "confluent" could not be activated because it does not exist.
總結(jié)
以上為個人經(jīng)驗,希望能給大家一個參考,也希望大家多多支持腳本之家。
相關(guān)文章
SpringMVC實現(xiàn)數(shù)據(jù)綁定及表單標簽
這篇文章主要為大家詳細介紹了SpringMVC實現(xiàn)數(shù)據(jù)綁定及表單標簽的相關(guān)資料,具有一定的參考價值,感興趣的小伙伴們可以參考一下2017-03-03簡單講解奇偶排序算法及在Java數(shù)組中的實現(xiàn)
這篇文章主要介紹了奇偶排序算法及Java數(shù)組的實現(xiàn),奇偶排序的時間復(fù)雜度為O(N^2),需要的朋友可以參考下2016-04-04Java獲取http和https協(xié)議返回的json數(shù)據(jù)
本篇文章主要介紹了Java獲取http和https協(xié)議返回的json數(shù)據(jù) ,本篇文章提供兩個方法,幫助各位如何獲取http和https返回的數(shù)據(jù)。有興趣的可以了解一下。2017-01-01SpringBoot集成mybatis連接oracle的圖文教程
這篇文章主要介紹了Spring Boot集成mybatis連接oracle的圖文教程,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教2022-02-02idea中springboot項目連接數(shù)據(jù)庫報錯的原因解析
這篇文章主要介紹了idea中springboot項目連接數(shù)據(jù)庫報錯的原因解析,本文給大家介紹的非常詳細,對大家的學(xué)習或工作具有一定的參考借鑒價值,需要的朋友可以參考下2020-12-12詳解Java刪除Map中元素java.util.ConcurrentModificationException”異常解決
這篇文章主要介紹了詳解Java刪除Map中元素java.util.ConcurrentModificationException”異常解,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習或者工作具有一定的參考學(xué)習價值,需要的朋友們下面隨著小編來一起學(xué)習學(xué)習吧2021-01-01淺談java String.split丟失結(jié)尾空字符串的問題
下面小編就為大家?guī)硪黄獪\談java String.split丟失結(jié)尾空字符串的問題。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2017-02-02