Maven settings 开源中国 镜像并下载本地仓库 - icoudsoft_saas的博客 - 博客频道 - CSDN.NET

创建时间:2016/3/29 9:58
来源:http://blog.csdn.net/icoudsoft_saas/article/details/50390823


2015-12-24 01:07 52人阅读 评论(0) 收藏 举报
.
分类:
maven(13)
.

版权声明:本文为博主原创文章,未经博主允许不得转载。

如果还没配置好Maven的朋友请先配置好Maven,配置Maven点击:http://blog.csdn.net/icoudsoft_saas/article/details/50390873

Maven settings文件里面的配置的镜像默认是国外的,由于大天朝的原因呢,下载国外的东西是很慢的,并且很容易出现中断或者下载失败的原因,

基于这个原因呢,2012年,开源中国终于弄了个China镜像,方便国内的Maven使用者:

配置如下:


第一:

  1. <mirrors>  
  2.     <!-- mirror  
  3.      | Specifies a repository mirror site to use instead of a given repository. The repository that  
  4.      | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used  
  5.      | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.  
  6.      |  
  7.     <mirror>  
  8.       <id>mirrorId</id>  
  9.       <mirrorOf>repositoryId</mirrorOf>  
  10.       <name>Human Readable Name for this Mirror.</name>  
  11.       <url>http://my.repository.com/repo/path</url>  
  12.     </mirror>  
  13.      -->  
  14.         <mirror>    
  15.             <id>nexus-osc</id>    
  16.             <mirrorOf>central</mirrorOf>    
  17.             <name>Nexus osc</name>    
  18.             <url>http://maven.oschina.net/content/groups/public/</url>    
  19.         </mirror>    
  20.         <mirror>    
  21.             <id>nexus-osc-thirdparty</id>    
  22.             <mirrorOf>thirdparty</mirrorOf>    
  23.             <name>Nexus osc thirdparty</name>    
  24.             <url>http://maven.oschina.net/content/repositories/thirdparty/</url>    
  25.               
  26.               
  27.         </mirror>       
  28.   </mirrors>  

第二:

  1. <profile>    
  2.             <id>jdk-1.4</id>    
  3.             <activation>    
  4.                 <jdk>1.4</jdk>    
  5.             </activation>    
  6.                       
  7.             <repositories>    
  8.                 <repository>    
  9.                     <id>nexus</id>    
  10.                     <name>local private nexus</name>    
  11.                     <url>http://maven.oschina.net/content/groups/public/</url>    
  12.                     <releases>    
  13.                         <enabled>true</enabled>    
  14.                     </releases>    
  15.                     <snapshots>    
  16.                         <enabled>false</enabled>    
  17.                     </snapshots>    
  18.                   </repository>    
  19.             </repositories>    
  20.               <pluginRepositories>    
  21.                 <pluginRepository>    
  22.                     <id>nexus</id>    
  23.                     <name>local private nexus</name>    
  24.                     <url>http://maven.oschina.net/content/groups/public/</url>    
  25.                     <releases>    
  26.                         <enabled>true</enabled>    
  27.                     </releases>    
  28.                     <snapshots>    
  29.                         <enabled>false</enabled>    
  30.                     </snapshots>    
  31.                 </pluginRepository>    
  32.               </pluginRepositories>    
  33.           </profile>    
  34.           <profile>    
  35.             <id>osc</id>    
  36.             <activation>    
  37.                 <activeByDefault>true</activeByDefault>    
  38.             </activation>    
  39.             <repositories>    
  40.                 <repository>    
  41.                     <id>osc</id>    
  42.                       <url>http://maven.oschina.net/content/groups/public/</url>    
  43.                 </repository>    
  44.                 <repository>    
  45.                     <id>osc_thirdparty</id>    
  46.                     <url>http://maven.oschina.net/content/repositories/thirdparty/</url>    
  47.                 </repository>    
  48.               </repositories>    
  49.             <pluginRepositories>    
  50.                 <pluginRepository>    
  51.                     <id>osc</id>    
  52.                     <url>http://maven.oschina.net/content/groups/public/</url>    
  53.                   </pluginRepository>    
  54.             </pluginRepositories>    
  55.           </profile>  

第三:

创建本地仓库目录(目录必须事先建好)

  1. <localRepository>本地仓库路径</localRepository>  


然后打开dos命令:

执行:mvn help:system


坐等jar包下到本地仓库吧

.
0
0