一、下载 maven
官网: Maven -- Download Apache Maven
**注意:**idea 和 maven 的版本问题,不然 idea 启动项目会发生兼容性错误。如 2020 版本 idea 支持 3.6.3 左右的 maven 版本,用 3.9版本的 maven 会报错。
二、配置maven全局配置文件 conf/settings.xml
2.1、配置 settings.xml 文件绑定本地仓库
bash
<localRepository>D:\soft_install_home\repository</localRepository>

2.2、 settings.xml 文件配置远程仓库"阿里云仓库"
XML
<mirror>
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
</mirror>

2.3、配置 jdk 编译语言级别,默认的太低了,idea运行会有警告
bash
<profile>
<id>development</id>
<activation>
<jdk>1.8</jdk>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
</properties>
</profile>

三、设置 maven 环境变量
3.1、新建环境变量 MAVEN_HOME , 变量值为 maven 的解压 url。

3.2、配置到 Path 变量中: %MAVEN_HOME%\bin

四、验证 maven 是否配置成功
在 cmd 命令行中输入:出现版本号代表成功!
bash
mvn -version
