Maven的服务器在国外,有时候有些资源下载速度奇慢无比,为了加速,可以添加国内的一些镜像地址到
Maven的settings.xml(一般在apache-maven-3.6.2/conf/下)。
我电脑里有多个IDE和本地自己安装的Maven,所有使用everything直接找到所有的settings.xml文件
添加如下xml:
<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.
|
<mirror>
<id>mirrorId</id>
<mirrorOf>repositoryId</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://my.repository.com/repo/path</url>
</mirror>
-->
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id>uk</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://uk.maven.org/maven2/</url>
</mirror>
<mirror>
<id>CN</id>
<name>OSChina Central</name>
<url>http://maven.oschina.net/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id>nexus</id>
<name>internal nexus repository</name>
<!-- <url>http://192.168.1.100:8081/nexus/content/groups/public/</url>-->
<url>http://repo.maven.apache.org/maven2</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
之后就可以享受飞一般的速度了。
本文介绍如何通过修改settings.xml文件,添加国内镜像地址来加速Maven资源的下载,解决因服务器在国外导致的下载速度慢问题。只需在settings.xml中加入相应镜像配置,即可体验快速的下载速度。
1059

被折叠的 条评论
为什么被折叠?



