下载maven,解压到指定的文件夹
下载地址:https://archive.apache.org/dist/maven/maven-3/(建议下载3.6.3的版本)
验证安装是否成功
配置环境变量
要在 maven 的服务器解压的文件中找到 conf 文件夹下的 settings.xml 文件进行修改
仓库默认地址的国外的。国内有很多镜像仓库,为避免下载过慢或超时所以换成国内的仓库。
打开 maven 的配置文件( windows 机器一般在 maven 安装目录的 conf/settings.xml ),在标签中添加 mirror 子节点:
<!-- nexus-aliyun 首选,放第一位,有不能下载的包,再去做其他镜像的选择 -->
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>central</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
<!-- 阿里云仓库 -->
<mirror>
<id>aliyunmaven</id>
<mirrorOf>*</mirrorOf>
<name>阿里云公共仓库</name>
<url>https://maven.aliyun.com/repository/public</url>
</mirror>
<mirror>
<id>alimaven1</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<!-- 中央仓库1 -->
<mirror>
<id>repo1</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://repo1.maven.org/maven2/</url>
</mirror>
<!-- 中央仓库2 -->
<mirror>
<id>repo2</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://repo2.maven.org/maven2/</url>
</mirror>
<mirror>
<id>alimaven</id>
<mirrorOf>central</mirrorOf>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
</mirror>
<mirror>
<id>maven-default-http-blocker</id>
<mirrorOf>external:http:*</mirrorOf>
<name>Pseudo repository to mirror external repositories initially using HTTP.</name>
<url>http://0.0.0.0/</url>
<blocked>true</blocked>
</mirror>
<!-- sprintio 镜像地址 -->
<mirror>
<id>sprintio</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>https://repo.spring.io/libs-snapshot/</url>
</mirror>
<!-- Google 镜像地址 -->
<mirror>
<id>google</id>
<name>google maven</name>
<url>https://maven.google.com/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<!-- Maven china镜像地址 -->
<mirror>
<id>maven.net.cn</id>
<name>Mirror from Maven in china</name>
<url>http://maven.net.cn/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>```
配置本地仓库
idea配置本地maven