点击右边栏的 maven 窗口(如果没有,通过 View -> Tool Windows -> maven 启用)。然后点击配置按钮
然后找到 User settings file 对应路径的 settings.xml 文件(如果没有则在对应目录新建,也可以选中右面的 Override 然后指定自己的文件),将文件改为如下内容:
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">
aliyunmaven
*
阿里云公共仓库
https://maven.aliyun.com/repository/public
aliyunmaven
*
阿里云谷歌仓库
https://maven.aliyun.com/repository/google
aliyunmaven
*
阿里云阿帕奇仓库
https://maven.aliyun.com/repository/apache-snapshots
aliyunmaven
*
阿里云spring仓库
https://maven.aliyun.com/repository/spring
aliyunmaven
*
阿里云spring插件仓库
https://maven.aliyun.com/repository/spring-plugin
(如果本来有文件,则将中间 至 部分复制到相应位置)