1、Maven解压
下载maven,并解压到自己的目录。
2、配置环境变量
MAVEN_HOME
D:\green\apache-maven-3.6.3
系统变量path添加:
D:\green\apache-maven-3.6.3\bin
验证:在cmd中输入
mvn -version
出现图片中的样式,即成功。
3、Maven 本地仓库配置
这是我的setting.xml文件位置:
D:\green\apache-maven-3.6.3\conf\settings.xml
设置本地仓库位置(本人设置如下):
<localRepository>D:\green\maven_repository</localRepository>
设置阿里云仓库(标签内):
<!-- 阿里云仓库 -->
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
设置 Java 版本(标签内):
<!-- java版本 -->
<profile>
<id>jdk-1.8</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>1.8</jdk>
</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>