美文网首页
maven仓库中心mirrors配置多个下载中心(执行最快的镜像

maven仓库中心mirrors配置多个下载中心(执行最快的镜像

作者: 码农梦醒 | 来源:发表于2019-12-04 06:25 被阅读0次

maven的settings.xml配置文件

<mirrors>
    <!-- mirror
     | Specifies a repository mirror site to use instead of a given repository. The repository that
     | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
     | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
     |
    <mirror>
      <!-- 唯一标识一个mirror -->
      <id>mirrorId</id>
      <!-- 代表了一个镜像的替代位置,例如central就表示代替官方的中央库 -->
      <mirrorOf>repositoryId</mirrorOf>
      <!-- 貌似没多大用,相当于描述 -->
      <name>Human Readable Name for this Mirror.</name>
      <!-- 是官方的库地址 -->
      <url>http://my.repository.com/repo/path</url>
    </mirror>
     -->
     <!--默认的中央仓库-->
     <mirror>
      <id>mirrorId</id>
      <mirrorOf>repositoryId</mirrorOf>
      <name>Human Readable Name for this Mirror.</name>
      <url>http://my.repository.com/repo/path</url>
    </mirror>
    <!--自定义添加-->
    <mirror>    
      <id>repo2</id>    
      <mirrorOf>central</mirrorOf>    
      <name>Human Readable Name for this Mirror.</name>    
      <url>http://repo2.maven.org/maven2/</url>    
    </mirror>  
    <!--阿里云镜像-->
    <mirror>  
      <id>alimaven</id>  
      <name>aliyun maven</name>  
      <url>http://maven.aliyun.com/nexus/content/groups/public/</url>  
      <mirrorOf>central</mirrorOf>          
    </mirror>
     <mirror>    
      <id>ui</id>    
      <mirrorOf>central</mirrorOf>    
      <name>Human Readable Name for this Mirror.</name>    
      <url>http://uk.maven.org/maven2/</url>    
    </mirror>    
 
    <mirror>    
      <id>ibiblio</id>    
      <mirrorOf>central</mirrorOf>    
      <name>Human Readable Name for this Mirror.</name>    
      <url>http://mirrors.ibiblio.org/pub/mirrors/maven2/</url>    
    </mirror>  
 
    <mirror>    
      <id>jboss-public-repository-group</id>    
      <mirrorOf>central</mirrorOf>    
      <name>JBoss Public Repository Group</name>    
      <url>http://repository.jboss.org/nexus/content/groups/public</url>    
    </mirror> 
    <!--访问慢的网址放入到后面-->
     <mirror>    
      <id>CN</id>  
      <name>OSChina Central</name>         
      <url>http://maven.oschina.net/content/groups/public/</url>  
      <mirrorOf>central</mirrorOf>    
    </mirror>
    <mirror>    
      <id>net-cn</id>    
      <mirrorOf>central</mirrorOf>    
      <name>Human Readable Name for this Mirror.</name>    
      <url>http://maven.net.cn/content/groups/public/</url>     
    </mirror> 
    <mirror>    
      <id>JBossJBPM</id>  
      <mirrorOf>central</mirrorOf> 
      <name>JBossJBPM Repository</name>   
      <url>https://repository.jboss.org/nexus/content/repositories/releases/</url>  
    </mirror> 
  </mirrors>

重要说明:

此处指定多个mirrors镜像,镜像只会执行第一个位置mirror。

官网说明如下:http://maven.apache.org/guides/mini/guide-mirror-settings.html

设置多个镜像只会识别第一个镜像下载jar包。配置的多个mirror可以都放着不影响,选取一个镜像下载比较快的放在第一个就行。

相关文章

  • maven仓库中心mirrors配置多个下载中心(执行最快的镜像

    maven的settings.xml配置文件 重要说明: 此处指定多个mirrors镜像,镜像只会执行第一个位置m...

  • maven setting mirror配置

    maven仓库镜像配置(配置到setting.xml中的中)

  • 2020-01-17

    今日,项目更新pom文件后发现从镜像仓库下载jar包失败,随后根据maven配置文件配置的镜像中心路径 mirro...

  • 那些年踩过的maven坑

    maven依赖 下载缓慢原因:maven中央仓库在国外, 下载慢解决: 配置国内仓库,作为中央仓库的镜像修改位置:...

  • Maven之多镜像配置下载优先级

    1. 问题: 由于最近在使用maven仓库时,经常出现从maven私服中下载jar包下载不下来,索性,配置多个镜像...

  • maven配置阿里云仓库

    全局配置 在maven的setting.xml配置中添加镜像仓库的配置,在mirrors节点下面添加子节点: 单项...

  • 简化Android库上传到Maven仓库的gradle配置

    配置 android 上传到 maven 中心仓库,发现配置的代码有点多,而且如果有多个库模块需要上传,则需要复制...

  • Eclipse配置Maven

    本篇文章教你如何在Eclipse中配置Maven 包含maven的下载;仓库及镜像的配置;环境变量配置;Eclip...

  • IDEA配置Maven

    本篇文章教你如何在IDEA中配置Maven 包含Maven的下载;仓库及镜像的配置;环境变量配置;IDEA添加Ma...

  • maven仓库镜像

    阿里云仓库镜像 gradle 配置 阿里云 代理了很多公共的maven仓库 网易云仓库镜像gradle配置

网友评论

      本文标题:maven仓库中心mirrors配置多个下载中心(执行最快的镜像

      本文链接:https://www.haomeiwen.com/subject/wykkgctx.html