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回車,出現以下信息,則代表安裝成功
11.在C:\Users\administrator\.m2(或者C:\Users\your name\.m2,.m2文件夾默認是隱藏的,需要顯示隱藏文件才能看到)下建立settings.xml,內容如下
<?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/