eclipse下实现maven项目在tomcat容器热部署方法

eclipse下实现maven项目在tomcat容器热部署方法

黄进青 2013-2-17

1、eclipse安装maven插件、svn插件

2、从svn检查maven结构web项目(可部署到tomcat下)

3、修改远程或本地的tomcat配置文件apache-tomcat-6.0.29/conf/tomcat-users.xml,添加用户,如下所示:

<role rolename="manager"/>
<user username="admin" password="admin" roles="manager"/>

4、修改maven的settings.xml,增加server,如下所示(所有java开发工程师手中最新的settings.xml已经包含下面的配置):

<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中配置maven build,内容如下:clean tomcat:redeploy -Dmaven.test.skip=true,可参考下图


8、执行maven build后的结果如下所示:

。。。。。

[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 activated because it does not exist.


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值