查找Maven 配置
打开 IDEA 配置找到 settings.xml
maven 配置文件所在路径
我的 maven 配置文件在默认路径 C:\Users\Administrator\.m2\settings.xml
添加镜像站点
打开 settings.xml
文件找到 <mirrors><mirrors/>
标签,在其中添加镜像站点
镜像站点汇总
以下列出一些镜像站点:
<mirror>
<id>maven-central</id>
<name>Maven Central</name>
<url>https://repo1.maven.org/maven2</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id>maven-central2</id>
<name>Maven Central</name>
<url>https://repo.maven.apache.org/maven2/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id>aliyunmaven</id>
<name>阿里云公共仓库</name>
<url>https://maven.aliyun.com/repository/public</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id>huaweicloud</id>
<mirrorOf>central,apache,google</mirrorOf>
<url>https://repo.huaweicloud.com/repository/maven/</url>
</mirror>
<mirror>
<id>tencent</id>
<name>tencent maven mirror</name>
<url>https://mirrors.tencent.com/nexus/repository/maven-public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
项目中配置仓库地址
<repositories>
<repository>
<id>maven-central</id>
<name>Maven Central</name>
<url>https://repo1.maven.org/maven2</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>