第一步:右键项目,选择Maven->Create ‘settings.xml’
已经存在的话是Open ‘settings.xml’:
第二步:在settings.xml文件中增加阿里云镜像地址,代码如下:
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"><mirrors><mirror><id>central</id><url>https://repo1.maven.org/maven2/</url><mirrorOf>central</mirrorOf></mirror><mirror><id>netease</id><url>http://maven.netease.com/repository/public/</url><mirrorOf>central</mirrorOf></mirror><mirror><id>huaweicloud</id><url>https://repo.huaweicloud.com/repository/maven/</url><mirrorOf>central</mirrorOf></mirror><mirror><id>tencent</id><url>https://mirrors.cloud.tencent.com/repository/maven/</url><mirrorOf>central</mirrorOf></mirror><mirror><id>ustc</id><url>http://mirrors.ustc.edu.cn/maven/maven2/</url><mirrorOf>central</mirrorOf></mirror><mirror><id>nju</id><url>http://maven.nju.edu.cn/repository/</url><mirrorOf>central</mirrorOf></mirror><mirror><id>tsinghua</id><url>https://repo.maven.apache.org/maven2/</url><mirrorOf>central</mirrorOf></mirror><mirror><id>bit</id><url>http://mirror.bit.edu.cn/maven/</url><mirrorOf>central</mirrorOf></mirror><mirror><id>neusoft</id><url>https://mirrors.neusoft.edu.cn/maven2/</url><mirrorOf>central</mirrorOf></mirror><mirror><id>opencas</id><url>http://maven.opencas.cn/maven/</url><mirrorOf>central</mirrorOf></mirror><mirror><id>bjtu</id><url>http://maven.bjtu.edu.cn/maven2/</url><mirrorOf>central</mirrorOf></mirror><mirror><id>aliyun</id><url>http://maven.aliyun.com/</url><mirrorOf>central</mirrorOf></mirror></mirrors>
</settings>