maven 配置阿里云镜像仓库

我个人感觉好像没什么用,你们可以参考一下,

在构建maven项目的时候,使用maven默认的仓库是海外的仓库,国内下载jar包会非常非常慢,使用国内的阿里镜像仓库的话速度会非常的快。

虽然网上已经有很多了,但是自己也记录一下,方便下次查询。

maven配置阿里云镜像仓库,可有两种方法。

一是配置setting.xml文件的镜像地址。

配置如下:

找到maven的配置文件,如 E:apache-maven-3.6.0conf 下的 settings.xml文件 找到节点,添加如下内容即可

<mirrors>
    <mirror>
        <id>nexus-aliyun</id>
        <mirrorOf>central</mirrorOf>
        <name>Nexus aliyun</name>
        <url>http://maven.aliyun.com/nexus/content/groups/public</url>
    </mirror>
  </mirrors>

2是直接在pom.xml文件中设置,修改uri为阿里云的地址

<url>http://maven.aliyun.com/nexus/content/groups/public</url>

http://maven.aliyun.com/nexus/content/groups/public

如此即可,下载依赖包就快的飞起

经验分享 程序员 微信小程序 职场和发展