1. 安装maven前须要先安装java,并设置JAVA_HOME环境变量。(详见jdk安装教程)
2. 将apache-maven-3.0.5-bin.zip放到d:\teamwork中,点击右键,解压到当前文件夹中。
3. 右键点击个人电脑,点属性,打开系统属性对话框,点高级选项卡中的环境变量
4. 点击系统变量的新建按钮
5. 填入以下信息后点击肯定
6. 找到变量path,双击打开
7. 将“%M2_HOME%\bin;”加入到变量值的最左侧(注意别落下分号),点击肯定
8. 再点击肯定关闭环境变量对话框
9. 按下win+R打开运行,输入cmd回车
10. 输入mvn –version回车,出现如下信息,则表明安装成功
html
11.在C:\Users\administrator\.m2(或者C:\Users\your name\.m2,.m2文件夹默认是隐藏的,须要显示隐藏文件才能看到)下创建settings.xml,内容以下java
<?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"> <profiles> <profile> <id>myNexus</id> <repositories> <repository> <id>nexus</id> <name>nexus</name> <url>http://1.1.1.1:8081/nexus/content/groups/public</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>nexus</id> <name>nexus</name> <url>http://1.1.1.1:8081/nexus/content/groups/public</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </pluginRepository> </pluginRepositories> </profile> </profiles> <activeProfiles> <activeProfile>myNexus</activeProfile> </activeProfiles> </settings>
将其中的1.1.1.1替换成团队的本身的nexus服务器地址,若是没有,则能够考虑使用oschina的maven库,将url替换为:http://maven.oschina.net/content/groups/public/ apache