前言
maven在国内连接到中央仓库下载jar包太慢了,如果想加速的话,可以切换到阿里云maven镜像库
2023.12.17
更新,更新https连接和更新新版阿里云链接
阿里云镜像仓库信息
具体可以移步阿里云Maven使用指南
仓库名称 | 阿里云仓库地址 | 阿里云仓库地址(老版) | 源地址 |
---|---|---|---|
central | https://maven.aliyun.com/repository/central | https://maven.aliyun.com/nexus/content/repositories/central | https://repo1.maven.org/maven2/ |
public | https://maven.aliyun.com/repository/public | https://maven.aliyun.com/nexus/content/groups/public | central仓和jcenter仓的聚合仓 |
gradle-plugin | https://maven.aliyun.com/repository/gradle-plugin | https://maven.aliyun.com/nexus/content/repositories/gradle-plugin | https://plugins.gradle.org/m2/ |
apache snapshots | https://maven.aliyun.com/repository/apache-snapshots | https://maven.aliyun.com/nexus/content/repositories/apache-snapshots | https://repository.apache.org/snapshots/ |
方案一:在POM.xml里面定义阿里云maven
下载jar包的时候很快,但是缺点就是maven相关的包比较慢
<repositories>
<repository>
<id>alimaven</id>
<name>aliyun maven</name>
<url>https://maven.aliyun.com/repository/public</url>
</repository>
</repositories>
就可以享用高速下载了
另外,需要什么类可以在以下地址进行搜索
http://maven.aliyun.com/mvn/search
方案二:设置settings.xml
这个mirror 镜像设置
比较全局,一般修改C:\Users\Administrator\.m2\settings.xml
,之后所有的maven相关的包也会从阿里云加载
<mirror>
<id>central</id>
<name>central</name>
<url>https://maven.aliyun.com/repository/public</url>
<mirrorOf>central</mirrorOf>
</mirror>