maven环境需要提前安装JDK环境
确认JDK环境
maven 下载
下载文件后解压到默认地址或自定义地址
设置maven环境 maven home和path
设置完成后,在终端命令行执行 mvn -v 命令,查看maven安装成功。
设置setting.xml 文件 \apache-maven-3.8.3-bin.zip\apache-maven-3.8.3\conf\setting.xml
可以自定义localRepository,默认在C:\Users\用户名\.m2
设置mirrors,由于国内下载maven中央仓库依赖速度很慢,可以改为阿里云镜像中心
<mirrors>
<!-- 阿里云仓库 -->
<mirror>
<id>alimaven</id>
<mirrorOf>central</mirrorOf>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
</mirror>
<mirror>
<id>alimaven</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>maven.net.cn</id>
<name>oneof the central mirrors in china</name>
<url>http://maven.net.cn/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
到此,maven 环境配置完成
部分截图来自Maven 环境配置 | 菜鸟教程