intellij-idea IDEA Maven 源修改为国内阿里云镜像的正确方式, 2027 年更新,亲测可用 - html,是建议我们这样设置的
文章目录
前言正确的设置方式IDEA 中的操作步骤
前言
由于众所周知的原因,maven的库在中国大陆非常慢。我在百度上搜到的大部分文章都是直接在~/.m2/settings.xml 加入以下内容。
aliyunmaven
central
aliyun maven
https://maven.aliyun.com/repository/public
其实这样设置,我发现其实镜像并没有改变,还是maven的中央库。
正确的设置方式
在maven库的官网上http://maven.apache.org/settings.html,是建议我们这样设置的。但是我发现,有时候,阿里云maven源有的包下载不了。所以我建议设置如果阿里云下载不了,就去下载中央库。所以我的设置如下:
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
central
阿里云公共仓库
https://maven.aliyun.com/repository/central
repo1
central
central repo
http://repo1.maven.org/maven2/
aliyunmaven
apache snapshots
阿里云阿帕奇仓库
https://maven.aliyun.com/repository/apache-snapshots
aliyunmaven
aliyunmaven
https://maven.aliyun.com/repository/public
default
true
true
MavenCentral
http://repo1.maven.org/maven2/
aliyunmavenApache
https://maven.aliyun.com/repository/apache-snapshots
IDEA 中的操作步骤
打开IntelliJ IDEA->Settings ->Build, Execution, Deployment ->Build Tools > Maven 拼多多帮助力入口
或者直接搜索maven
具体如下图所示: