下载Maven 地址:http://maven.apache.org/download.cgi
如果没有安装JDK 必须先下载并安装JDK,配置JDK的环境变量JAVA_HOME,否则maven无法使用eclipse安装maven插件后必须重新定位maven到本地maven目录
注:安装Maven3.3需要提前安装好JDK 1.7以上版本
将下载好的Maven安装包解压到磁盘中,我解压的路径为D:\apache-maven-3.3.9
右击计算机,选择属性->高级系统设置->环境变量,点击系统变量的新建按钮。添加新的系统环境变量MAVEN_HOME,设置其值为刚才解压的maven路径:[D:\apache-maven-3.3.9]
配置系统的path变量,在其尾部加添加[;%MAVEN_HOME%\bin;]
接下来在命令窗口使用mvn -v来验证一下Maven是否安装成功。如能正确输出Maven的安装版本,则表示它安装成功了
//据说执行完在用户目录下会出现.m2文件 但是没有
随后执行了这条命令 :mvn help:system
打开当前用户的目录,可以在其中找到.m2文件夹
.m2文件里没有settings.xml,可以在maven的安装目录/conf里复制一份 然后改成自己想要的样子
<?xml version="1.0" encoding="UTF-8"?>
<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>/path/to/local/repo</localRepository>
<interactiveMode>true</interactiveMode>
<offline>false</offline>
<pluginGroups>
</pluginGroups>
<proxies>
<proxy>
<id>optional</id>
<active>true</active>
<protocol>http</protocol>
<username>proxyuser</username>
<password>proxypass</password>
<host>proxy.host.net</host>
<port>80</port>
<nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>
</proxies>
<servers>
<server>
<id>deploymentRepo</id>
<username>repouser</username>
<password>repopwd</password>
</server>
</server>
<mirrors>
<mirror>
<id>mirrorId</id>
<mirrorOf>repositoryId</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://my.repository.com/repo/path</url>
</mirror>
</mirrors>
<profiles>
<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>
</profiles>
<activeProfiles>
<activeProfile>alwaysActiveProfile</activeProfile>
<activeProfile>anotherAlwaysActiveProfile</activeProfile>
</activeProfiles>
</settings>