您的位置:首页 > 其它

maven添加阿里云镜像仓库

2018-01-23 10:47 239 查看
现在我们大多数java项目都使用maven来管理我们的依赖包,默认情况我们会从国外的maven中心仓库下载依赖,这样就造成下载速度较慢的问题。我们可以通过添加阿里云镜像提高maven下载依赖包的速度。

1. 打开maven安装文件的settings.xml文件,默认情况都会在C:\Users\userxx\.m2下面,这里userxx是你的使用用户名称。 

添加下面的语句:

<mirrors>
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>*</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
</mirrors>添加完成后settings.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"> <mirrors>
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>*</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
</mirrors>
</settings>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  maven