• maven中央仓库不能访问的解决办法


    导入Maven项目,编译时候出错,好象是接不上apache.org/maven2,下载不了maven-resources-plugin-2.6.jar 这个jar包

    出错内容:

    Plain Text code

    ?

    1

    2

    3

    4

    5

    6

    7

    8

    9

    10

    11

    12

    13

    14

    15

    16

    17

    18

    19

    20

    [INFO]?Scanning?for?projects...

    [INFO]

    [INFO]?------------------------------------------------------------------------

    [INFO]?Building?maven-01?0.0.1-SNAPSHOT

    [INFO]?------------------------------------------------------------------------

    Downloading:?https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.6/maven-resources-plugin-2.6.pom

    [INFO]?------------------------------------------------------------------------

    [INFO]?BUILD?FAILURE

    [INFO]?------------------------------------------------------------------------

    [INFO]?Total?time:?1.234?s

    [INFO]?Finished?at:?2014-09-05T09:57:26+08:00

    [INFO]?Final?Memory:?2M/6M

    [INFO]?------------------------------------------------------------------------

    [ERROR]?Plugin?org.apache.maven.plugins:maven-resources-plugin:2.6?or?one?of?its?dependencies?could?not?be?resolved:?Failed?to?read?artifact?descriptor?for?org.apache.maven.plugins:maven-resources-plugin:jar:2.6:?Could?not?transfer?artifact?org.apache.maven.plugins:maven-resources-plugin:pom:2.6?from/to?central?(https://repo.maven.apache.org/maven2):?sun.security.validator.ValidatorException:?PKIX?path?building?failed:?sun.security.provider.certpath.SunCertPathBuilderException:?unable?to?find?valid?certification?path?to?requested?target?->?[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/PluginResolutionException

    网上查了一下,无法访问maven.org网站的解决此问题理论上有两个办法,一个是在maven的配置文件中设置代理,另一个是在maven的配置文件中设置联通网络下,能够访问的中央仓库的mirrors。因为也不好找稳定的代理,在网上搜索了两个可用的mirror站点,配置方式如下:

    1、打开maven配置文件(maven安装目录下的conf目录下的settings.xml文件)

    2、搜索mirrors关键字,加入mirror镜像节点

    ibiblio.org ibiblio Mirror of http://repo1.maven.org/maven2/ http://mirrors.ibiblio.org/pub/mirrors/maven2 central jboss-public-repository-group central JBoss Public Repository Group http://repository.jboss.org/nexus/content/groups/public

    但是这两个也不好用,在这里使用 OSC Maven 仓库找到开源中国的资源库,

    配置了他们的镜像

    osc \* http://maven.oschina.net/content/groups/public/

    成功编译。

  • 相关阅读:
    sslpinning笔记
    代码随想录算法训练营第五十七天| 392.判断子序列、115.不同的子序列
    基于SSM的网络教学(作业)管理系统
    Web 开发中 route 和 router 有什么区别?
    C#硬件接口开发------一文了解WMI
    一文带你掌握Spring Web异常处理方式
    330. 按要求补齐数组
    SpringBoot+MyBatis Plus对Map中Date格式转换的处理
    JavaScript中的Hoisting机制
    阿斯达年代记三强争霸服务器没反应 安装中发生错误的解决方法
  • 原文地址:https://blog.csdn.net/m0_67402125/article/details/126435230