1、maven官网下载
下载地址:Maven – Download Apache Maven
旧版本下载地址:Index of /dist/maven/maven-3
2、解压压缩包(自定义位置)
3、环境配置(路径为解压路径 —— 红框中变量命名要一样)
5、检验是否安装成功 mvn -v
6、自定义位置,创建一个空文件夹,作为 maven 本地仓库(路径不可包含中文、空格)
7、在解压目录中找到 setting文件修改本地仓库位置
8、打开setting文件, <localRepository>标签内修改为刚刚创建的本地仓库路径
<!-- 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:\repository</localRepository>
9、配置国内镜像源,国内一般选用阿里云提供的镜像仓库,默认有时连接不上;(只配置阿里云仓库即可)
<!-- 阿里云仓库 -->
<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>
<name>Human Readable Name for this Mirror.</name>
<url>http://repo1.maven.org/maven2/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<!-- 中央仓库2 -->
<mirror>
<id>repo2</id>
<name>Human Readable Name for this Mirror.</name>
<url>http://repo2.maven.org/maven2/</url>
<mirrorOf>central</mirrorOf>
</mirror>
10、配置全局JDK(1.8版本为例)
<profile>
<id>jdk-1.4</id>
<activation>
<jdk>1.4</jdk>
</activation>
<repositories>
<repository>
<id>jdk14</id>
<name>Repository for JDK 1.4 builds</name>
<url>http://www.myhost.com/maven/jdk14</url>
<layout>default</layout>
<snapshotPolicy>always</snapshotPolicy>
</repository>
</repositories>
</profile>
替换为 ↓↓↓↓↓↓
<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>