1、eclipse安装maven插件、svn插件
2、从svn检查maven结构web项目(可部署到tomcat下)
3、修改远程或本地的tomcat配置文件apache-tomcat-6.0.29/conf/tomcat-users.xml,添加用户,如下所示:
<rolerolename="manager"/>
<userusername="admin" password="admin"roles="manager"/>
4、修改maven的settings.xml,增加server,如下所示:
<server>
<id>tomcat</id>
<username>admin</username>
<password>admin</password>
</server>
5、启动tomcat(进入http://localhost:8080/manager/html页面大家可以管理tomcat下的所有应用)
6、修改pom.xml文件,引入tomcat插件,以实现热部署,如下所示:
。。。
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<configuration>
<url>http://localhost:8080/manager/html</url>
<server>tomcat</server>
<path>/wallet</path>
</configuration>
<version>1.1</version>
</plugin>
。。。
7、在eclipse中配置mavenbuild,内容如下:cleantomcat:redeploy
-Dmaven.test.skip=true,可参考附图
8、执行mavenbuild后的结果如下所示:
。。。。。
[INFO]Building 0.0.1-SNAPSHOT
[INFO]------------------------------------------------------------------------
[INFO]
[INFO]--- maven-clean-plugin:2.4.1:clean
(default-clean) @ wallet ---
[INFO]Deleting /Users/junqinghuang/Documents/workspace/ewallet/target
[INFO]
[INFO]>>> tomcat-maven-plugin:1.1:redeploy
(default-cli) @ wallet>>>
[WARNING]The POM for apache-httpclient:commons-httpclient:jar:3.1
is missing,no dependency information available
[INFO]
[INFO]--- maven-resources-plugin:2.4.3:resources
(default-resources) @wallet ---
[WARNING]Using platform. encoding (EUC_CN
actually) to copy filtered resources,i.e. build is platform. dependent!
[INFO]Copying 9 resources
[INFO]
[INFO]--- maven-compiler-plugin:2.3.2:compile
(default-compile) @ wallet---
[INFO]Compiling 198 source files to/Users/junqinghuang/Documents/workspace/ewallet/target/classes
[INFO]
[INFO]--- maven-resources-plugin:2.4.3:testResources(default-testResources)
@ wallet ---
[WARNING]Using platform. encoding (EUC_CN
actually) to copy filtered resources,i.e. build is platform. dependent!
[INFO]skip non existing resourceDirectory/Users/junqinghuang/Documents/workspace/ewallet/src/test/resource
[INFO]
[INFO]--- maven-compiler-plugin:2.3.2:testCompile
(default-testCompile) @wallet ---
[INFO]Not compiling
test sources
[INFO]
[INFO]--- maven-surefire-plugin:2.7.1:test
(default-test) @ wallet ---
[INFO]Tests are skipped.
[INFO]
[INFO]--- maven-war-plugin:2.1.1:war
(default-war) @ wallet ---
[INFO]Packaging webapp
[INFO]Assembling webapp [wallet] in[/Users/junqinghuang/Documents/workspace/ewallet/src/main/webapp]
[INFO]Processing war project
[INFO]Webapp assembled in [518 msecs]
[INFO]Building war:/Users/junqinghuang/Documents/workspace/ewallet/target/wallet-0.0.1-SNAPSHOT.war
[INFO]WEB-INF/web.xml already added,
skipping
[INFO]
[INFO]<<< tomcat-maven-plugin:1.1:redeploy
(default-cli) @ wallet<<<
[INFO]
[INFO]--- tomcat-maven-plugin:1.1:redeploy
(default-cli) @ wallet ---
[INFO]Deploying war to http://localhost:8080/wallet
[INFO]OK - Undeployed application at
context path /wallet
[INFO]OK - Deployed application at context
path /wallet
[INFO]------------------------------------------------------------------------
[INFO]BUILD SUCCESS
[INFO]------------------------------------------------------------------------
[INFO]Total time: 12.435s
[INFO]Finished at: Mon Feb 18 11:52:05
CST 2013
[INFO]Final Memory: 16M/113M
[INFO]------------------------------------------------------------------------
[WARNING]The requested profile "develop"
could not be activatedbecause it does not exist.