解决网速慢时maven仓库访问慢
构建maven项目时会下载很多依赖,会从官网地址下载是个外国网站,访问速度会很慢,但可以通过修改maven的settings.xml文件换成国内的镜像地址就可以加快访问速度:
一、找到settings.xml
(1)我的放在C:\Users\zrk\.m2下
(2)idea里依次点File->Settings,在弹出框搜索maven,可以查看或配置路径
(3)eclipse下可以参考:
https://www.cnblogs.com/flying607/p/6223148.html
二、修改配置
打开settings.xml,搜索mirrors,找到下段代码
<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. | --> </mirrors>
在mirrors中添加一个<mirror>,保存即可
<mirror> <id>mirrorId</id> <mirrorOf>central</mirrorOf> <name>Human Readable Name for this Mirror.</name> <url>http://maven.aliyun.com/nexus/content/groups/public/</url> </mirror>
最终效果: