- 下载Maven
- 下载地址为:http://maven.apache.org/download.html,现在最高的版本为3.0.2,在win7下载文件为:apache-maven-3.0.2-bin.zip
- 把zip文件解压到目录:C:\Program Files\Apache Software Foundation, 当然可以解压到其他文件下,在后续的环境变量设置中注意就行了。
- 设置环境变量
- 设置Maven环境变量
- M2_HOME = C:\Program Files\Apache Software Foundation\apache-maven-3.0.2
- M2 = %M2_HOME%\bin
- MAVEN_OPTS = -Xms256m –Xmx512m
- 在Maven执行之前请确认JDK是否配置成功,检查:%JAVA_HOME%\bin 是否在path目录中? %JAVA_HOME%值请根据实际的jdk位置进行配置,如:”C:\Program Files\Java\jdk1.5.0_02”
- 验证是否安装成功
- mvn –version 可以验证是否成功,如果成功打印如下内容:
- ---------------------------------------------------------------------
Apache Maven 3.0.2 (r1056850; 2011-01-09 08:58:10+0800)
Java version: 1.6.0_07, vendor: Sun Microsystems Inc.
Java home: C:\Program Files\Java\jdk1.6.0_07\jre
Default locale: zh_CN, platform encoding: GBK
OS name: "windows vista", version: "6.1", arch: "x86", family: "windows"
--------------------------------------------------------------------------