使用Maven Cargo 插件进行远程Tomcat6的部署(三)
上一篇 /
下一篇 2012-06-06 17:36:37
/ 个人分类:Maven
本地配置完成,你在根pom项目下运行"mvn install"就可以把最新WAR快照部署到Tomcat中运行。
这里有两个值得注意的地方:
(1)<wait>参数, 如果你设为"true"的话,它会告知你把Tomcat作为Maven构建过程的一部分,然后提示可通过快捷键Ctrl-C或者设置属性wait为false来关闭Session。但是这实际上只是把Tomcat脱离出Maven构建过程而没有真正关闭Tomcat进程。所以你必须再执行"pre-clean"或者"clean"目标来真正关闭它。
(2)validate目标,我这里首先执行stop操作,如果不定义这个目标的话,重复执行"install"目标会出现JVM端口绑定错误。
四、部署项目到远程环境
同样,远程部署同样是在<build>节点下配置Cargo:
1)首先配置的是<container>节点,详细描述如下:
- <configuration>
- <wait>true</wait>
- <container>
- <containerId>tomcat6x</containerId>
- <type>remote</type>
- </container>
2)接下来配置容器的属性,详细描述如下:
- <configuration>
-
- <type>runtime</type>
- <properties>
- <cargo.hostname>${cargo.tomcat.manager.hostname}</cargo.hostname>
- <cargo.servlet.port>${cargo.tomcat.manager.port}</cargo.servlet.port>
- <cargo.tomcat.manager.url>
- ${cargo.tomcat.manager.protocol}://${cargo.tomcat.manager.hostname}:${cargo.tomcat.manager.port}/manager
- </cargo.tomcat.manager.url>
- <cargo.remote.username>${cargo.tomcat.manager.username}</cargo.remote.username>
- <cargo.remote.password>${cargo.tomcat.manager.password}</cargo.remote.password>
- <cargo.tomcat.ajp.port>${cargo.tomcat.manager.ajp.port}</cargo.tomcat.ajp.port>
- </properties>
- </configuration>
3)Cargo远程部署,详细操作如下:
- <deployer>
-
- <type>remote</type>
- <deployables>
-
- <deployable>
-
- <pingURL>
- ${cargo.tomcat.manager.protocol}://${cargo.tomcat.manager.hostname}:${cargo.tomcat.manager.port}/${myproject.name}
- </pingURL>
-
- <pingTimeout>300000</pingTimeout>
- <groupId>${cargo.project.groupid}</groupId>
- <artifactId>${cargo.project.artifactid}</artifactId>
- <type>war</type>
- <properties>
- <context>${myproject.name}</context>
- </properties>
- </deployable>
- </deployables>
- </deployer>
- </configuration>
4)Cargo执行阶段和目标:
- <executions>
- <execution>
- <id>start-container</id>
- <phase>pre-integration-test</phase>
- <goals>
- <goal>deployer-redeploy</goal>
- </goals>
- </execution>
-
收藏
举报
TAG:
标题搜索
日历
|
日 |
一 |
二 |
三 |
四 |
五 |
六 |
| 1 | 2 | 3 | 4 | 5 | 6 |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 | | | | |
数据统计
- 访问量: 9444
- 日志数: 12
- 建立时间: 2011-03-08
- 更新时间: 2012-06-06