基于maven-cargo-plugin 的tomcat7.x热部署记录

本文档介绍了如何利用maven-cargo-plugin进行Tomcat 7.x应用的热部署。重点在于配置cargo远程URL,确保使用的是文本管理器,并修改tomcat-users.xml文件,为用户分配manager-script角色以完成部署操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

pom.xm 文件代码片段
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.4.3</version>
<configuration>
<container>
<containerId>tomcat7x</containerId>
<type>remote</type>
</container>
<configuration>
<type>runtime</type>
<properties>
<cargo.remote.username>admin</cargo.remote.username>

<cargo.remote.password>admin</cargo.remote.password>

<cargo.remote.uri>http://192.168.17.194:8080/manager/text</cargo.remote.uri>
</properties>

</configuration>

<deployables>
<deployable>
<groupId>com.pre</groupId>
<artifactId>pre-dms-devp</artifactId>
<type>war</type>
</deployable>
</deployables>


</configuration>
<executions>
<!-- 执行的动作 -->
<execution>
<id>verify-deployer</id>
<phase>install</phase>      <!-- 解析install -->
<goals>
<goal>deployer-redeploy</goal>
</goals>
</execution>
</executions>

</plugin>

<!-- 这边cargo.remote.uri,需要用http://192.168.17.194:8080/manager/text 官方文档的英文解释

With Tomcat 7, the Tomcat manager has multiple aspects to be careful about:

  • Your browser by default accesses the HTML-based manager whereas CARGO needs to use the text-based manager. As a result, if you want to set the RemotePropertySet.URI manually, please make sure you set the URL for the text-based manager, for examplehttp://production27:8080/manager/text
  • The text-based manager requires to be accessed by a user with the manager-script role; and by default no user has that role. As a result, please make sure you modify your tomcat-users.xml file to give that role to a user.

    You can read more on the Tomcat documentation: http://tomcat.apache.org/tomcat-7.0-doc/manager-howto.html

tomcat-users.xm 配置文件

<tomcat-users>
<role rolename="manager-gui"/>
<role rolename="manager-status"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<user   username="admin"   password="admin"   roles="manager-gui,manager-status,manager-script,manager-jmx"/>
</tomcat-users>


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值