maven下载依赖失败问题及解决

 更新时间:2023年04月14日 11:08:10   作者:clooker  
这篇文章主要介绍了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.

总结

以上为个人经验,希望能给大家一个参考,也希望大家多多支持脚本之家。

相关文章

  • MyBatis中的占位符入参全面详解

    MyBatis中的占位符入参全面详解

    这篇文章主要为大家介绍了MyBatis中的占位符全面详解,有需要的朋友可以借鉴参考下,希望能够有所帮助,祝大家多多进步,早日升职加薪
    2023-03-03
  • 解决springboot项目找不到resources目录下的资源问题

    解决springboot项目找不到resources目录下的资源问题

    这篇文章主要介绍了解决springboot项目找不到resources目录下的资源问题,具有很好的参考价值,希望对大家有所帮助。如有错误或未考虑完全的地方,望不吝赐教
    2021-08-08
  • Spring的@Value如何从Nacos配置中心获取值并自动刷新

    Spring的@Value如何从Nacos配置中心获取值并自动刷新

    这篇文章主要介绍了Spring的@Value如何从Nacos配置中心获取值并自动刷新,具有很好的参考价值,希望对大家有所帮助。如有错误或未考虑完全的地方,望不吝赐教
    2022-07-07
  • idea中导入项目后main方法无法Run的解决

    idea中导入项目后main方法无法Run的解决

    这篇文章主要介绍了idea中导入项目后main方法无法Run的解决方案,具有很好的参考价值,希望对大家有所帮助。
    2023-03-03
  • 基于Ant路径匹配规则AntPathMatcher的注意事项

    基于Ant路径匹配规则AntPathMatcher的注意事项

    这篇文章主要介绍了基于Ant路径匹配规则AntPathMatcher的注意事项,具有很好的参考价值,希望对大家有所帮助。如有错误或未考虑完全的地方,望不吝赐教
    2021-11-11
  • 详解ZXing-core生成二维码的方法并解析

    详解ZXing-core生成二维码的方法并解析

    本文给大家介绍ZXing-core生成二维码的方法并解析,主要用到goggle发布的jar来实现二维码功能,对此文感兴趣的朋友一起学习吧
    2016-05-05
  • java虚拟机深入学习之内存管理机制

    java虚拟机深入学习之内存管理机制

    java虚拟机在程序运行时将内存划分为多个区域,每个区域作用,生命周期各不相同,下面这篇文章主要给大家介绍了关于java虚拟机深入学习之内存管理机制的相关资料,文中通过示例代码介绍的非常详细,需要的朋友可以参考下
    2018-11-11
  • IDEA快速显示Run DashBoard的图文详解

    IDEA快速显示Run DashBoard的图文详解

    这篇文章主要介绍了IDEA快速显示Run DashBoard的图文详解,本文通过图文并茂的形式给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下
    2020-12-12
  • SpringBoot SSO轻松实现(附demo)

    SpringBoot SSO轻松实现(附demo)

    这篇文章主要介绍了SpringBoot SSO轻松实现(附demo),文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
    2021-01-01
  • mybatis动态生成sql语句的实现示例

    mybatis动态生成sql语句的实现示例

    在MyBatis中,动态SQL是一个非常重要的特性,它允许我们根据条件动态地生成SQL语句,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
    2024-11-11

最新评论