Maven:優秀的構建工具java
依賴javaspring
1、下載apache
maven:官網,http://maven.apache.org/app
maven3.1.1:http://maven.apache.org/download.cgimaven
2、解壓,例如:D:\apache-maven-3.1.1ide
3、配置環境變量工具
MAVEN_HOME:D:\apache-maven-3.1.1url
MAVEN:%MAVEN_HOME%\binspa
MAVEN_OPTS:-Xms256m -Xmx512m (可選)3d
添加到path:%MAVEN%
檢測是否成功 cmd.exe ----> mvn -version
4、配置maven配置文件、項目
一、修改m2的配置目錄D:\apache-maven-3.1.1\bin\m2.conf
set maven.home default ${user.home}/m2 ------>set maven.home default ${maven.home}/m2
默認爲當前用戶,
二、修改repository的配置目錄D:\apache-maven-3.1.1\conf\settings.xml
a、找到該標籤<localRepository>/path/to/local/repo</localRepository>
修改成:<localRepository>D:/apache-maven-3.1.1/repo</localRepository>
b、找到<servers>標籤
在其中加入:
<server> <id>nexus-releases</id> <username>admin</username> <password>admin</password> </server> <server> <id>nexus-snapshots</id> <username>admin</username> <password>admin</password> </server>
c、找到<profiles>標籤
在其中加入:
<profile> <id>spring</id> <repositories> <repository> <id>springsourcerepo</id> <name>SpringSource Repository</name> <url>http://repo.springsource.org/release</url> </repository> </repositories> </profile> <profile> <id>dev</id> <repositories> <repository> <id>nexus</id> <url>http://172.16.10.59:8081/nexus/content/groups/public/</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>nexus</id> <url>http://172.16.10.59:8081/nexus/content/groups/public</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </pluginRepository> </pluginRepositories> </profile>
以上這段可參考:http://wenku.baidu.com/link?url=ZvbHFA2Rx_817I17t6_Ee7cEnb3415MH5ChpKNMPDwtZficpZvKUHVwECQdH7oVx_TXwvnhGuQS5HmGLh0voWb8J_O62eO_uf5tJ947msuC
d、找到<profiles>標籤
<pluginGroups>中加入:<pluginGroup>org.mortbay.jetty</pluginGroup>
5、生成本身的maven項目
運行cmd.exe--->進入要創建項目的目錄------->執行
mvn archetype:create -DgroupId=com.demo.app -DartifactId=demo-app