使用maven+cargo远程发布应用

感觉它还是依赖tomcat本身提供的web服务进行发布,所以需要依赖tomcat服务开启,并且保留了原有的root,manager目录进行管理,同时需要设置对应的帐号权限。做了简单的热部署测试,速度还是不错的,只是maven还不够熟练,不知如何和ant一样建立生命周期的depend,每次去点击鼠标的速度实在不舒服,不过暂时还是先放下,下去就要把项目迁移到maven下,争取多动手实践。


<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>Simple_mvn_web_demo</groupId>
<artifactId>simplemvn</artifactId>
<name>simple</name>
<version>1.0</version>
<packaging>war</packaging>

<dependencies>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>servlet-api</artifactId>
<version>6.0.29</version>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<!--可选-->
<!-- <executions>
<execution>
<id>verify-deploy</id>
<phase>pre-integration-test</phase>
<goals>
<goal>deployer-redeploy</goal>
</goals>
</execution>
</executions>-->
<configuration>
<container>
<containerId>tomcat6x</containerId>
<type>remote</type>
</container>
<configuration>
<type>runtime</type>
<properties>
<cargo.tomcat.manager.url>${tomcat.manager}</cargo.tomcat.manager.url>
<cargo.remote.username>${tomcat.manager.username}</cargo.remote.username>
<cargo.remote.password>${tomcat.manager.password}</cargo.remote.password>
</properties>
</configuration>
<deployer>
<type>remote</type>
<deployables>
<deployable>
<groupId>Simple_mvn_web_demo</groupId>
<artifactId>simplemvn</artifactId>
<type>war</type>
<pingURL>http://${tomcat.host}:${tomcat.port}/cargo/welcome.do</pingURL>
</deployable>
</deployables>
</deployer>
</configuration>
</plugin>
</plugins>
</build>


<profiles>
<profile>
<id>dev</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<tomcat.host>192.168.3.133</tomcat.host>
<tomcat.port>8080</tomcat.port>
<tomcat.server>development</tomcat.server>
<tomcat.manager.username>admin</tomcat.manager.username>
<tomcat.manager.password>secret</tomcat.manager.password>
</properties>
</profile>
</profiles>

<properties>
<tomcat.manager>http://${tomcat.host}:${tomcat.port}/manager</tomcat.manager>
</properties>


</project>


补充部分,用于设置在maven生命周期的package时,自动远程发布项目,当然也可以在shell里面同时调用两个生命周期,这样就不用点击两次,当时如果依赖war,那么发布的速度是否足够快呢

<executions>
<execution>
<phase>package</phase>
<goals>
<goal>deployer-redeploy</goal>
</goals>
</execution>
</executions>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值