cargo远程部署项目到tomcat

tomcat-users.xml,至少要添加manager,manager-gui,manager-script,manager-jmx,manager-status,
添加权限
<tomcat-users>
   <role rolename="tomcat"/>
   <role rolename="role1"/>
   <role rolename="manager"/>
   <role rolename="admin"/>
   <role rolename="manager-gui"/>
   <role rolename="manager-script"/>
 <role rolename="manager-jmx"/>
  <role rolename="manager-status"/>

   <!--admin角色没有的要注意添上-->
   <user username="tomcat" password="tomcat" roles="tomcat"/>
   <user username="admin" password="admin" roles="admin,manager,tomcat,manager-gui,manager-script,manager-jmx,manager-status"/>
   <!--你用哪个用户做管理员,则需要分配相应的角色,我给admin用户分配了admin和manager连个角色-->
 </tomcat-users>


新版无需修改maven的settings.xml文件,网上很多误导别人的
mvn cargo:redeploy
<!-- 远程部署 ,tomcat必须启动-->
            <plugin>  
                <groupId>org.codehaus.cargo</groupId>  
                <artifactId>cargo-maven2-plugin</artifactId>  
                <version>1.4.9</version>  
                <configuration>  
                    <container>  
                        <containerId>tomcat7x</containerId>  
                        <type>remote</type>  
                    </container>  
                    <configuration>  
                        <type>runtime</type>  
                        <properties>
                         <cargo.hostname>localhost</cargo.hostname>
                           <cargo.servlet.port>80</cargo.servlet.port>
                           <cargo.servlet.port>80</cargo.servlet.port>
                            <cargo.remote.username>admin</cargo.remote.username>  
                            <cargo.remote.password>admin</cargo.remote.password>  
                            <cargo.remote.manager.url>http://localhost/manager</cargo.remote.manager.url>  
                        </properties>  
                    </configuration>  
                </configuration>  
            </plugin>


注意:cargo.hostname是必须配置的,如果不配置默认是localhost!也就是说cargo.tomcat.manager.url里配置了什么都是不起作用的。端口也一样,要配置。



如果服务器上已运行了部署项目,必须mvn cargo:redeploy启动,用mvn cargo:deploy会报错Error writing request body to server

如果出现The username you provided is not allowed to use the text-based Tomcat Manager (error 403)错误,必须把tomcat7部署用户的权限定义为“manager-script”,才可以成功部署。

Encountered exception javax.management.RuntimeErrorException: Error invoking method check,缺少manager-jmx权限




manager-gui — Access to the HTML interface.

manager-status — Access to the "Server Status" page only.

manager-script — Access to the tools-friendly plain text interface that is described in this document, and to the "Server Status" page.

manager-jmx — Access to JMX proxy interface and to the "Server Status" page.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值