maven 下载慢,maven 国内镜像

maven的默认的中央仓库为:maven.apache.org ,当本地仓库或者自己的maven 私服不存在相关的jar时,如没有特别设置,就去检查maven中央仓库有没有。

由于连接国外网站时网速特慢,为解决这个问题,os china 建立了一个maven 的私服。为了记忆,特将此记录。

settings.xml 设置镜像方法步骤如下: 

1. setting.xml mirrors 设置

修改\apache-maven-3.1.0\conf目录下的setting.xml文件,加入镜像文件地址,setting.xml文件如下所示

[html]  view plain copy print ?
  1. <?xml version="1.0" encoding="UTF-8"?>  
  2.   
  3.   
  4. <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"  
  5.     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
  6.     xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">  
  7.     
  8.     <pluginGroups>  
  9.     </pluginGroups>  
  10.  
  11.     <proxies>  
  12.     </proxies>  
  13.    
  14.     <servers>  
  15.     </servers>  
  16.   
  17.     <mirrors>  
  18.         <mirror>  
  19.             <id>nexus-osc</id>  
  20.             <mirrorOf>central</mirrorOf>  
  21.             <name>Nexus osc</name>  
  22.             <url>http://maven.oschina.net/content/groups/public/</url>  
  23.         </mirror>  
  24.         <mirror>  
  25.             <id>nexus-osc-thirdparty</id>  
  26.             <mirrorOf>thirdparty</mirrorOf>  
  27.             <name>Nexus osc thirdparty</name>  
  28.             <url>http://maven.oschina.net/content/repositories/thirdparty/</url>  
  29.         </mirror>  
  30.     </mirrors>  
  31.    
  32.     <profiles>  
  33.     </profiles>  
  34. </settings>  

2. pom.xml repositories 设置
[html]  view plain copy print ?
  1. <!-- Maven库设置 -->
  2. <repositories>
           <repository>
                 <id>nexus</id>
                 <name>local private nexus</name>
                 <url>http://maven.oschina.net/content/groups/public/</url>
                 <releases>
                     <enabled>true</enabled>
                 </releases>
                 <snapshots>
                     <enabled>false</enabled>
                 </snapshots>
             </repository>
         </repositories>
         <pluginRepositories>
             <pluginRepository>
                 <id>nexus</id>
                 <name>local private nexus</name>
                 <url>http://maven.oschina.net/content/groups/public/</url>
                 <releases>
                     <enabled>true</enabled>
                 </releases>
                 <snapshots>
                     <enabled>false</enabled>
                 </snapshots>
             </pluginRepository>
    </pluginRepositories>


  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值