mvn clean install
mvn org.apache.maven.plugins:maven-eclipse-plugin:2.6:eclipse
mvn -Dtest=org.apache.nutch.util.TestURLUtil test
mvn -Dtest=org.apache.nutch.util.TestURLUtil -Dmaven.surefire.debug test
創建普通應用項目:
mvn archetype:create -DgroupId=com.byread -DartifactId=blog創建WEB項目:
mvn archetype:create -DgroupId= com.byread -DartifactId=blogweb -DarchetypeArtifactId= maven-archetype-webapp
創建appfuse 項目:
mvn archetype:create -DarchetypeGroupId =org.appfuse.archetypes -DarchetypeArtifactId =appfuse-basic-struts -DremoteRepositories =http://static.appfuse.org/releases -DarchetypeVersion =2.0.2 -DgroupId=com.mycompany.app -DartifactId=myproject
---------------- ---------------- 命令說明---------------- ----------------
一。archetype( 內建插件,他的create任務將建立項目骨架 ): archetype:create
二。groupId 項目的java包結構:com.byread
三。artifactId 項目的名稱 :blog
四。 archetypeArtifactId( 項目骨架的類型 ):
* maven-archetype-archetype
* maven-archetype-j2ee-simple
* maven-archetype-mojo
* maven-archetype-portlet
* maven-archetype-profiles (currently under development)
* maven-archetype-quickstart
* maven-archetype-simple (currently under development)
* maven-archetype-site
* maven-archetype-site-simple, and
* maven-archetype-webapp
---------------- ---------------- 其他命令說明---------------- ----------------
發佈到本地:
mvn install:install -file -Dfile=D:/opensource/dbunit-2.2/dbunit-2.2.jar -DgroupId=dbunit-DartifactId=junitperf -Dversion=2.2 -Dpackaging=jar
發佈到遠程:
mvn deploy:deploy -file -DgroupId=staticComparison -DartifactId=static-comparison -Dversion=2.0 -Dpackaging=jar -Dfile=c:/staticComparison_2.0.jar -Durl=file:Y:\repo
生成Eclipse項目結構:
mvn eclipse:eclipse
清理(刪除target目錄下編譯內容)
mvn clean
僅有頁面文件發生變化時
mvn war:exploded
maven定義的生命週期中主要的相位如下:
validate : 驗證項目是否正確以及相關信息是否可用。
compile : 編譯。
test : 通過junit進行單元測試。
package : 根據事先指定的格式(比如jar),進行打包。
integration-test : 部署到運行環境中,準備進行集成測試。
verify : 對包進行有效性性和質量檢查。
install : 安裝到本地代碼庫。
deploy : 在集成或發佈環境,將包發佈到遠程代碼庫。