修改 Maven 默认的全局配置文件:
类 Unix 系统: Mac OS / Linux 默认在 ~/.m2/settings.xml
Windows 系统:一般在 Maven 安装目录的 conf/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 "> <!-- 添加以下这段 Mirror 配置 --> <mirrors> <!-- Aliyun --> <mirror> <id>aliyunmaven</id> <name>aliyun maven</name> <mirrorOf>*</mirrorOf> <url>https://maven.aliyun.com/repository/public</url> </mirror> </mirrors> </settings>