1、下载
选择这个下载 apache-maven-3.6.3-bin.zip
2、解压D盘
3、设置环境变量名:M2_HOME 变量值:D:\program files\maven 路径:%M2_HOME%\bin
4、测试
C:\Users\Administrator> mvn -v
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: D:\program files\maven\bin\..
Java version: 1.8.0_231, vendor: Oracle Corporation, runtime: D:\program files\Java\jdk1.8.0\jre
Default locale: zh_CN, platform encoding: GBK
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
5、修改远程中央仓库地址 D:\program files\maven\conf\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>
6、修改本地仓库 这里配置 D:\MavenRepository
<!-- localRepository
| The path to the local repository maven will use to store artifacts.
|
| Default: ${user.home}/.m2/repository
<localRepository>/path/to/local/repo</localRepository>
-->下面加入 <localRepository>D:\MavenRepository</localRepository>
7、测试
C:\Users\Administrator>mvn help:system
仓库里面已经更新成功了
8、IDEA 设置 Maven
选择 File → Settings → Bulid,Execution,Deployment → Build Tools → Maven
9、配置新建项目时 maven 默认路径
选择 Other settings → Settings for new projects → Bulid,Execution,Deployment → Build Tools → Maven