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文件如下所示
- <?xml version="1.0" encoding="UTF-8"?>
- <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
- <pluginGroups>
- </pluginGroups>
- <proxies>
- </proxies>
- <servers>
- </servers>
- <mirrors>
- <mirror>
- <id>nexus-osc</id>
- <mirrorOf>central</mirrorOf>
- <name>Nexus osc</name>
- <url>http://maven.oschina.net/content/groups/public/</url>
- </mirror>
- <mirror>
- <id>nexus-osc-thirdparty</id>
- <mirrorOf>thirdparty</mirrorOf>
- <name>Nexus osc thirdparty</name>
- <url>http://maven.oschina.net/content/repositories/thirdparty/</url>
- </mirror>
- </mirrors>
- <profiles>
- </profiles>
- </settings>
2. pom.xml repositories 设置