maven入门
1.解压部署Maven核心程序
①检查JAVA_HOME环境变量
C:\Windows\System32>echo %JAVA_HOME%
D:\DevInstall\jdk1.7.0_07
②解压Maven的核心程序
将apache-maven-3.2.2-bin.zip解压到一个非中文无空格的目录下。例如:D:\DevInstall\apache-maven-3.2.2
③配置环境变量
M2_HOME D:\DevInstall\apache-maven-3.2.2
path D:\DevInstall\apache-maven-3.2.2\bin
④查看Maven版本信息验证安装是否正确
C:\Windows\System32>mvn -v
Apache Maven 3.2.2 (45f7c06d68e745d05611f7fd14efb6594181933e; 2014-06-17T21:51:42+08:00)
Maven home: D:\DevInstall\apache-maven-3.2.2\bin\..
Java version: 1.7.0_07, vendor: Oracle Corporation
Java home: D:\DevInstall\jdk1.7.0_07\jre
Default locale: zh_CN, platform encoding: GBK
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
2.修改本地仓库
①默认本地仓库位置:~\.m2\repository
~表示当前用户的家目录,例如:C:\Users\[你当前登录系统的用户名]
②指定本地仓库位置的配置信息文件:apache-maven-3.2.2\conf\settings.xml
③在根标签settings下添加如下内容:<localRepository>[本地仓库路径]</localRepository>
设置为阿里仓库
<mirror> <id>alimaven</id> <name>aliyun maven</name> <url>http://maven.aliyun.com/nexus/content/groups/public/</url> <mirrorOf>central</mirrorOf> </mirror>