前言
创建maven项目或springboot项目时,往往需要从国外仓库下载jar包,速度非常慢,所以需要将依赖源设置为国内的数据源,
上一篇文章介绍了国内主要的镜像源,有兴趣的同学可以看一下:https://blog.csdn.net/douzhenwen/article/details/116061492
阿里云镜像是好多同学的首选,所以本文以阿里云镜像源为例,分享两种依赖源设置方式。
全局设置
文件位置:maven目录/conf/settings.xml
将以下配置写入<mirrors></mirrors>
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>*</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
项目设置
文件位置:maven项目中pom.xml
<repositories>
<repository>
<id>central</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups