标签:
pom.xml中加入cargo的Plugin声明:
1 <plugin> 2 <groupId>org.codehaus.cargo</groupId> 3 <artifactId>cargo-maven2-plugin</artifactId> 4 <version>1.4.9</version> 5 <configuration> 6 <container> 7 <containerId>tomcat7x</containerId> 8 <type>remote</type> 9 </container> 10 <configuration> 11 <type>runtime</type> 12 <properties> 13 <cargo.remote.uri>http://192.168.128.137:8080/manager/text</cargo.remote.uri> 14 <cargo.remote.username>admin</cargo.remote.username> 15 <cargo.remote.password>admin</cargo.remote.password> 16 </properties> 17 </configuration> 18 </configuration> 19 </plugin>
With Tomcat 7, the Tomcat manager has multiple aspects to be careful about:
RemotePropertySet.URI
manually, please make sure you set the URL for the text-based manager, for example http://production27:8080/manager/text
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.意思是:
1 <role rolename="manager-gui"/> 2 <role rolename="manager-script"/> 3 <role rolename="manager-jmx"/> 4 <role rolename="manager-status"/> 5 <role rolename="admin-gui"/> 6 <user username="admin" password="admin" roles="manager-gui,manager-script,manager-jmx,manager-status,admin-gui"/>
另外,无论是博客,还是《Maven实战》都写的是用属性cargo.tomcat.manager.url。可是我看Cargo Tomcat7x文档,甚至Cargo Tomcat6x文档里面都没有提到这个属性。我一开始就用这个属性,结果总是报错,说什么Connection refused。但在这两个文档文档最下面 For remote container o.c.c.c.tomcat.Tomcat7xRemoteContainer 一栏反而有个cargo.remote.uri属性,看名字好像是一个远程uri,我试了试,竟然成功远程部署了。
所以。。。还是文档比较重要。
https://codehaus-cargo.github.io/cargo/Home.html 里面有好多容器的cargo设置。
最后,你得先保证tomcat7x是运行状态的。用
mvn cargo:redeploy 命令部署就好了。
cargo的所有goals:(具体运用中自己看吧。。。)
Goals |
Description |
---|---|
|
Start a container. That goal will:
Note: A container that‘s started with |
|
Start a container and wait for the user to press
|
|
Stop a container. |
|
Stop and start again a container. If the container was not running before calling cargo:restart , it will simply be started. |
|
Create the configuration for a local container, without starting it. Note that the |
|
Package the local container. |
cargo:daemon-start |
Start a container via the daemon. Read more on: Cargo Daemon Note: The |
cargo:daemon-stop |
Stop a container via the daemon. Read more on: Cargo Daemon |
|
Deploy a deployable to a running container. Note: The |
|
Undeploy a deployable from a running container. |
|
Start a deployable already installed in a running container. |
|
Stop a deployed deployable without undeploying it. |
|
Undeploy and deploy again a deployable. If the deployable was not deployed before calling |
|
Merge several WAR files into one. |
|
Installs a container distribution on the file system. Note that the |
|
Get help (list of available goals, available options, etc.). |
标签:
原文地址:http://www.cnblogs.com/formyjava/p/4626259.html