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>
 ```


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM