一、全局配置
1、打开maven安装目录、找到settings.xml。
2、找到settings.xml中mirrrors标签,加入
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
3,下载依赖测试,可以看到路径已经是阿里云的了
二、针对项目配置
1、配置项目的pom.xml文件
<repositories>
<!-- 配置阿里云镜像 -->
<repository>
<id>maven-ali</id>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>fail</checksumPolicy>
</snapshots>
</repository>
</repositories>
2、测试效果