zoukankan      html  css  js  c++  java
  • maven私有库神坑之:“Downloading: http://repo.maven.apache.org/maven2/”深坑!!!!!!坑害了一周时间

    现象

    即使配置了私有库,并且在maven setting.xml中配置了mirror,但是,经常会遇到执行mvn命令的时候,会提醒:
    Downloading: http://repo.maven.apache.org/maven2/
    原因

    所有自定义pom.xml都是继承自super pom:

     1  <repositories>
     2     <repository>
     3       <id>central</id>
     4       <name>Central Repository</name>
     5       <url>http://repo.maven.apache.org/maven2</url>
     6       <layout>default</layout>
     7       <snapshots>
     8         <enabled>false</enabled>
     9       </snapshots>
    10     </repository>
    11   </repositories>
    12 
    13   <pluginRepositories>
    14     <pluginRepository>
    15       <id>central</id>
    16       <name>Central Repository</name>
    17       <url>http://repo.maven.apache.org/maven2</url>
    18       <layout>default</layout>
    19       <snapshots>
    20         <enabled>false</enabled>
    21       </snapshots>
    22       <releases>
    23         <updatePolicy>never</updatePolicy>
    24       </releases>
    25     </pluginRepository>
    26   </pluginRepositories>


    因此,当maven项目需要下载一些metadata、pom、jar的时候,会优先去中央仓库下载,导致内网用户各种报错!
    解决办法:

    在项目pom.xml中添加如下配置:

     1 <repositories>
     2     <repository>
     3         <id>central</id>
     4         <url>http://host:port/content/groups/public</url>
     5     </repository>
     6 </repositories>
     7 
     8 <pluginRepositories>
     9     <pluginRepository>
    10         <id>central</id>
    11         <url>http://host:port/content/groups/public</url>
    12     </pluginRepository>
    13 </pluginRepositories> 


    ————————————————
    版权声明:本文为CSDN博主「你好时光未老」的原创文章。
    原文链接:https://blog.csdn.net/qq_40369435/java/article/details/96881611

  • 相关阅读:
    log4j(二)——如何控制日志信息的输出?
    Java生成指定范围内的工具类
    JavaBean和Map转换封装类
    cron表达式详解
    数据库主键按照固定前缀生成工具类
    邮件发送工具类
    NFC
    牛逼辩论
    快速排序
    希尔排序
  • 原文地址:https://www.cnblogs.com/wangzhangtao/p/12692159.html
Copyright © 2011-2022 走看看