由于连接国外网站时网速特慢,为解决这个问题,os china 建立了一个maven 的私服。为了记忆,特将此记录。
settings.xml 设置镜像方法步骤如下:
1. mirrors 设置
1 <mirrors> 2 <!-- mirror | Specifies a repository mirror site to use instead of a given 3 repository. The repository that | this mirror serves has an ID that matches 4 the mirrorOf element of this mirror. IDs are used | for inheritance and direct 5 lookup purposes, and must be unique across the set of mirrors. | --> 6 <mirror> 7 <id>nexus-osc</id> 8 <mirrorOf>central</mirrorOf> 9 <name>Nexus osc</name> 10 <url>http://maven.oschina.net/content/groups/public/</url> 11 </mirror> 12 <mirror> 13 <id>nexus-osc-thirdparty</id> 14 <mirrorOf>thirdparty</mirrorOf> 15 <name>Nexus osc thirdparty</name> 16 <url>http://maven.oschina.net/content/repositories/thirdparty/</url> 17 </mirror></mirrors>
2. repositories 设置
1 <profile> 2 <id>jdk-1.4</id> 3 4 <activation> 5 <jdk>1.4</jdk> 6 </activation> 7 8 <repositories> 9 <repository> 10 <id>nexus</id> 11 <name>local private nexus</name> 12 <url>http://maven.oschina.net/content/groups/public/</url> 13 <releases> 14 <enabled>true</enabled> 15 </releases> 16 <snapshots> 17 <enabled>false</enabled> 18 </snapshots> 19 </repository> 20 </repositories> 21 <pluginRepositories> 22 <pluginRepository> 23 <id>nexus</id> 24 <name>local private nexus</name> 25 <url>http://maven.oschina.net/content/groups/public/</url> 26 <releases> 27 <enabled>true</enabled> 28 </releases> 29 <snapshots> 30 <enabled>false</enabled> 31 </snapshots> 32 </pluginRepository> 33 </pluginRepositories> 34 </profile>