maven下载依赖失败
·
前情提要
由于特殊原因,官方maven库经常连接失败,所以很多maven都配置了阿里云的镜像。但是阿里云的镜像里有很多依赖都没有,这时候如果你的项目需要这些依赖,就会导致编译失败。
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的问题,但是删除后仍然不能成功。
经过各种尝试,下面方法可行。
4. 解决办法
删除_remote.repositories和pom文件。
4.1 原始状态
目录文件:
错误日志:
[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
目录结构:
错误日志:
[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文件
目录结构:
错误日志:
[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.
更多推荐
已为社区贡献2条内容
所有评论(0)