1、首先下载maven,到官网下载即可http://maven.apache.org/download.cgi
2、下载好压缩包,解压到本地某一个目录即可,如:D:\apache-maven-3.1.1
3、配置下环境变量:MAVEN_HOME:D:\apache-maven-3.1.1
path中加入%MAVEN_HOME%\bin
4、测试,打开cmd,输入mvn -version,即可看到maven的版本号,安装完成
5、更改maven的本地仓库位置:找到maven在本地安装的目录,打开conf文件夹,里面有个settings.xml文件,加上
<localRepository>D:\maven-project\repository</localRepository>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<!-- 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:\maven-project\repository</localRepository>
<!-- interactiveMode
| This will determine whether maven prompts you when it needs input. If set to false,
| maven will use a sensible default value, perhaps based on some other setting, for
| the parameter in question.
|
| Default: true
<interactiveMode>true</interactiveMode>
-->