appFuse2.x第八篇--Maven2

Knowledge of Maven is not required to use AppFuse because the tutorials explain how to use it. If you're interested in learning Maven in-depth, please download the book Better Builds with Maven or Maven: The Definitive Guide ( zip). Both books are free - the first requires registration, the second is available without registration.

For a brief introduction to Maven see Building Web Applications with Maven 2 or The Maven 2 POM demystified. Other articles are available from the Articles on Maven page.

See Maven Plugins for information on plugins used in AppFuse.

Below is a list of commonly-used helpful Maven commands.

CommandDescription
mvn cleanDeletes all files in target directory or directories (for multi-module projects)
mvn jetty:run-warPackages and deploys your application to Jetty, reachable at http://localhost:8080
mvn -Dcargo.wait=truePackages and deploys your application to active Cargo profile (Tomcat 5.5.x by default), reachable at http://localhost:8080/yourapp-version
mvn testRuns all tests in src/test/java. Use "-Dtest=ClassName" (not fully-qualified) to run individual tests.
 Use -Dsurefire.useFile=false if you want to see test failures in your console (like Ant) and -Dmaven.surefire.debug if you want to open a debugger on port 5005 w/ suspend=y.
mvn packageCreates a WAR or JAR depending on your project type
mvn integration-testRuns UI tests in Tomcat using Cargo
mvn installInstalls generated artifacts in your local repository
mvn siteCreates project site and reports
mvn -UChecks for updated plugins and downloads if they exist
mvn -oWork offline
mvn --helpSee full list of optional commands

Ant vs. Maven

If you used AppFuse 1.x in the past and have taken the time to memorize its useful Ant commands, the following table should help you convert to using Maven.

Ant commandMaven commandDescription
ant setup-dbmvn hibernate3:hbm2ddl dbunit:operationCreates and populates your database
ant test-allmvn integration-testRuns unit and integration tests
ant cleanmvn cleanDeletes the target directory
ant compilemvn compileCompiles all source files
ant warmvn packageCreates a WAR file
ant deploymvn jetty:run-warDeploys a WAR to embedded instance of Jetty and starts it
ant test-daomvn test -Dtest=*DaoTestRuns all DAO tests
ant test-servicemvn test -Dtest=*ManagerTestRuns all Manager tests

Installing a local Maven Repository

If you're using Maven 2 in your organization on multiple projects, it's often a good idea to setup a local Maven repository on your intranet. There's a few different strategies for doing this:

<!-- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http:/ 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值