您的位置:首页 > 其它

Maven settings 开源中国 镜像并下载本地仓库

2015-12-24 01:07 218 查看
如果还没配置好Maven的朋友请先配置好Maven,配置Maven点击:/article/10035302.html

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

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

配置如下:

第一:

<mirrors>
<!-- mirror
| Specifies a repository mirror site to use instead of a given repository. The repository that
| this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
| for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
|
<mirror>
<id>mirrorId</id>
<mirrorOf>repositoryId</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://my.repository.com/repo/path</url>
</mirror>
-->
<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>


第二:

<profile>
<id>jdk-1.4</id>
<activation>
<jdk>1.4</jdk>
</activation>

<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>
</profile>
<profile>
<id>osc</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>osc</id>
<url>http://maven.oschina.net/content/groups/public/</url>
</repository>
<repository>
<id>osc_thirdparty</id>
<url>http://maven.oschina.net/content/repositories/thirdparty/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>osc</id>
<url>http://maven.oschina.net/content/groups/public/</url>
</pluginRepository>
</pluginRepositories>
</profile>


第三:

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

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


然后打开dos命令:
执行:mvn help:system

坐等jar包下到本地仓库吧
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: