简介
在使用 Maven 构建 Java 项目时,默认中央仓库(Central Repository)位于国外,下载依赖速度较慢。配置阿里云 Maven 镜像源(Aliyun Maven Mirror) 可显著提升依赖下载速度。
修改 settings.xml(推荐,全局生效)
加入如下配置文件
xml
<mirrors>
<!-- 阿里云镜像 -->
<mirror>
<id>aliyunmaven</id>
<name>阿里云公共仓库</name>
<url>https://maven.aliyun.com/repository/public</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
其他仓库
| 仓库类型 | URL |
|---|---|
| 公共仓库(推荐) | https://maven.aliyun.com/repository/public |
| central 代理 | https://maven.aliyun.com/repository/central |
| jcenter 代理 | https://maven.aliyun.com/repository/jcenter |
| spring 代理 | https://maven.aliyun.com/repository/spring |