maven换源

默认的Maven源为国外,下载速度非常慢,修改成阿里源可提高速度

(1)找到 apache-maven-3.5.2\conf 目录中的 settings.xml 文件

(2) 修改maven 本地仓库地址,

首先在D:\Program Files创建文件夹MavenRepository ;

找到settings.xml 文件中   打开注释修改如下:

D:\Program Files\MavenRepository

(3)添加阿里源 ,找到   </ mirrors>标签,标签中添加mirror子节点,内容如下:

<mirror>
    <id>aliyunmaven</id>
    <mirrorOf>*</mirrorOf>
    <name>阿里云公共仓库</name>
    <url>https://maven.aliyun.com/repository/public</url>
</mirror>

(4)实测,速度起飞。如果是Spring 项目,可使用阿里代理仓库,

标签中加入对应的仓库使用地址。以使用spring代理仓为例:

<repository>
    <id>spring</id>
    <url>https://maven.aliyun.com/repository/spring</url>
    <releases>
        <enabled>true</enabled>
    </releases>
    <snapshots>
        <enabled>true</enabled>
    </snapshots>
</repository>
 ```
posted @ 2020-06-01 19:11  程序员小宇  阅读(9320)  评论(0编辑  收藏  举报