zoukankan      html  css  js  c++  java
  • 51-maven私有库神坑之:“Downloading: http://repo.maven.apache.org/maven2/”

    maven私有库神坑之:“Downloading: http://repo.maven.apache.org/maven2/”

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

    原因:
    所有自定义pom.xml都是继承自super pom:
    http://maven.apache.org/ref/3.0.4/maven-model-builder/super-pom.html
    super pom中有如下内容:

    <repositories>
    <repository>
    <id>central</id>
    <name>Central Repository</name>
    <url>http://repo.maven.apache.org/maven2</url>
    <layout>default</layout>
    <snapshots>
    <enabled>false</enabled>
    </snapshots>
    </repository>
    </repositories>
    
    <pluginRepositories>
    <pluginRepository>
    <id>central</id>
    <name>Central Repository</name>
    <url>http://repo.maven.apache.org/maven2</url>
    <layout>default</layout>
    <snapshots>
    <enabled>false</enabled>
    </snapshots>
    <releases>
    <updatePolicy>never</updatePolicy>
    </releases>
    </pluginRepository>
    </pluginRepositories>
    

      


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

    解决办法:
    在项目pom.xml中添加如下配置:

    <repositories>
    <repository>
    <id>central</id>
    <url>http://host:port/content/groups/public</url>
    </repository>
    </repositories>
    
    <pluginRepositories>
    <pluginRepository>
    <id>central</id>
    <url>http://host:port/content/groups/public</url>
    </pluginRepository>
    </pluginRepositories>
    

      

  • 相关阅读:
    数组和对象常用方法汇总
    基于vue的悬浮碰撞窗口(用于打广告的)组件
    时间的基本处理
    防抖动和节流阀
    A. 配置xftp和xshell来远程管理Linux服务器
    课堂练习-找水王
    评价软件
    构建之法阅读笔记02
    学习进度条博客11
    用户场景
  • 原文地址:https://www.cnblogs.com/zhumengdexiaobai/p/10816961.html
Copyright © 2011-2022 走看看