综述
用maven做项目,最郁闷的莫过于某些依赖库下载不了。被墙了,你懂的。使用maven镜像仓库及其重要,特别是国内的镜像,可以有效缓解被墙疼痛。
常用的镜像
国外镜像
ibiblio.org
ibiblio central ibiblio Mirror of http://repo1.maven.org/maven2/ http://mirrors.ibiblio.org/pub/mirrors/maven2/
jboss
jboss-public-repository-group central JBoss Public Repository Group http://repository.jboss.org/nexus/content/groups/public
repo2
repo2 central Human Readable Name for this Mirror. http://repo2.maven.org/maven2/
uk.maven.org
ui central Human Readable Name for this Mirror. http://uk.maven.org/maven2/
国内镜像
oschina.net
nexus-osc * Nexus osc http://maven.oschina.net/content/groups/public/
net.cn
net-cn central Human Readable Name for this Mirror. http://maven.net.cn/content/groups/public/
使用镜像
下文以oschina.net的镜像为例子.
1.Maven 的安装目录下的 conf 文件下有个 settings.xml
文件,编辑该文件
2.在<mirrors>中插入:
nexus-osc * Nexus osc http://maven.oschina.net/content/groups/public/
3.这里是配置 Maven 的 mirror 地址指向OSChina 的 Maven 镜像地址。 在执行 Maven 命令的时候, Maven 还需要安装一些插件包,这些插件包的下载地址也让其指向 oschina.net 的 Maven 地址。在<profiles>中插入:
jdk-1.4 1.4 nexus local private nexus http://maven.oschina.net/content/groups/public/ true false nexus local private nexus http://maven.oschina.net/content/groups/public/ true false
参考: