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

来源:互联网 发布:java基础入门课后笔记 编辑:程序博客网 时间:2024/05/21 06:37
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>


原创粉丝点击