最近在接触Spring的时候经常从网上下载开源项目,但是每次构建都太慢了,刚开始我是直接挂机等待自动下载,有时候一晚上都无法下载完成,
于是改为手动下载jar包,也就是从http://maven.aliyun.com/nexus/content/repositories/central/,或者http://maven.aliyun.com/nexus/content/groups/public/
又或者https://repo.maven.apache.org/maven2/ 这些仓库里下载代码, 然后去.m2路径下手动替换相应的文件。但是缺点显而易见,手动太慢了,于是网上继续搜索解决方案,得到以下方案, 修改D:\apache-maven-3.2.1\conf 目录下的settings.xml文件
在<mirrors></mirrors>中添加以下代码:
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>central</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
但是依然没起效果, 于是继续查找资料,得到新方案, 将settings.xml复制到.m2文件夹中,
重启eclipse 生效。也就是说,修改C:\Users\Administrator\.m2 文件夹下的settings.xml 才能生效。
如果.m2没有该文件,请从D:\apache-maven-3.2.1\conf 目录,把该文件夹复制过去。。
阿里云MAVEN镜像仓库----------》彻底解决maven下载慢的问题
原文:https://www.cnblogs.com/shitulaoma/p/12422279.html