利用maven插件cargo远程(本地)自动部署
2011-09-04 19:23
781 查看
pom.xml
利用remote方式,前提要启动好tomcat,以及设置访问tomcat的权限即可。
运行命令:mvn cargo:redeploy
Java代码
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>cn.gzjp.wapportal</groupId>
<artifactId>gpas_manager</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>manager Maven Webapp</name>
<url>http://maven.apache.org</url>
<properties>
<springframework.version>2.5.6</springframework.version>
<junit.version>4.7</junit.version>
<tomcat.manager>http://${tomcat.host}:${tomcat.port}/manager</tomcat.manager>
</properties>
<profiles>
<profile>
<id>dev</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<tomcat.host>172.31.36.214</tomcat.host>
<tomcat.port>8080</tomcat.port>
<tomcat.server>development</tomcat.server>
<tomcat.manager.username>admin</tomcat.manager.username>
<tomcat.manager.password>admin</tomcat.manager.password>
</properties>
</profile>
</profiles>
<build>
<finalName>gpas_manager</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<!--
<plugin>
使用Cargo实现自动化部署
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.0.6</version>
<configuration>
<container>
<containerId>tomcat6x</containerId>
<home>F:\apache-tomcat-6.0.18</home>
</container>
<configuration>
<type>existing</type>
<home>F:\apache-tomcat-6.0.18</home>
</configuration>
</configuration>
-->
<!--
<configuration>
<container>
<containerId>tomcat6x</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.tomcat.manager.url>
http://172.31.36.214:8080/manager
</cargo.tomcat.manager.url>
</properties>
</configuration>
</configuration>
</plugin>
-->
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.0.6</version>
<!--可选-->
<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>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<type>war</type>
<pingURL>http://${tomcat.host}:${tomcat.port}/cargocpc/index.html</pingURL>
<properties>
<!-- deployer是部署时的相关配置,这个context是用来声明工程部署后的上下文,也就是
主机地址后面的一级目录位置。这个设置在maven构建中还是很必要的。因为maven默认打出
的war包是工程名+版本号,部署时如果不设置这里的context,那上下文就变成了工程名+版本号
的形式。这会使访问变得很不方便。注意,即使你通过修改war插件中的warName也是不能达到这个
目的,因为cargo认定的默认war包名就是工程名+版本号的形式。也可以利用finalName来制定 -->
<context>${artifactId}</context>
</properties>
</deployable>
</deployables>
</deployer>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
<version>${springframework.version}</version>
</dependency>
<dependency>
<groupId>com.danga</groupId>
<artifactId>memcached</artifactId>
<version>2.0.1</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.5.2a</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.5.2a</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>
<version>2.1_3</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.3.GA</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>rome</groupId>
<artifactId>rome-fetcher</artifactId>
<version>1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.sawen21</groupId>
<artifactId>rss4j</artifactId>
<version>1.0.0</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jsp-api</artifactId>
<version>2.0</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>opensymphony</groupId>
<artifactId>quartz</artifactId>
<version>1.6.2</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.extremecomponents</groupId>
<artifactId>extremecomponents</artifactId>
<version>1.0.1</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<artifactId>commons-lang</artifactId>
<groupId>commons-lang</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.ce.cetag</groupId>
<artifactId>cetag</artifactId>
<version>1.0.0</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.1</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.4</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>2.0.14</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.1</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>0.9.27</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>ant</groupId>
<artifactId>ant</artifactId>
<version>1.7.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
<version>1.0</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
<version>3.2.1.ga</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>3.6.1.Final</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-spring-plugin</artifactId>
<version>2.0.11.2</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-codebehind-plugin</artifactId>
<version>2.0.11.2</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-tiles-plugin</artifactId>
<version>2.0.11.2</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.1.2</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
利用remote方式,前提要启动好tomcat,以及设置访问tomcat的权限即可。
运行命令:mvn cargo:redeploy
Java代码
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>cn.gzjp.wapportal</groupId>
<artifactId>gpas_manager</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>manager Maven Webapp</name>
<url>http://maven.apache.org</url>
<properties>
<springframework.version>2.5.6</springframework.version>
<junit.version>4.7</junit.version>
<tomcat.manager>http://${tomcat.host}:${tomcat.port}/manager</tomcat.manager>
</properties>
<profiles>
<profile>
<id>dev</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<tomcat.host>172.31.36.214</tomcat.host>
<tomcat.port>8080</tomcat.port>
<tomcat.server>development</tomcat.server>
<tomcat.manager.username>admin</tomcat.manager.username>
<tomcat.manager.password>admin</tomcat.manager.password>
</properties>
</profile>
</profiles>
<build>
<finalName>gpas_manager</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<!--
<plugin>
使用Cargo实现自动化部署
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.0.6</version>
<configuration>
<container>
<containerId>tomcat6x</containerId>
<home>F:\apache-tomcat-6.0.18</home>
</container>
<configuration>
<type>existing</type>
<home>F:\apache-tomcat-6.0.18</home>
</configuration>
</configuration>
-->
<!--
<configuration>
<container>
<containerId>tomcat6x</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.tomcat.manager.url>
http://172.31.36.214:8080/manager
</cargo.tomcat.manager.url>
</properties>
</configuration>
</configuration>
</plugin>
-->
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.0.6</version>
<!--可选-->
<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>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<type>war</type>
<pingURL>http://${tomcat.host}:${tomcat.port}/cargocpc/index.html</pingURL>
<properties>
<!-- deployer是部署时的相关配置,这个context是用来声明工程部署后的上下文,也就是
主机地址后面的一级目录位置。这个设置在maven构建中还是很必要的。因为maven默认打出
的war包是工程名+版本号,部署时如果不设置这里的context,那上下文就变成了工程名+版本号
的形式。这会使访问变得很不方便。注意,即使你通过修改war插件中的warName也是不能达到这个
目的,因为cargo认定的默认war包名就是工程名+版本号的形式。也可以利用finalName来制定 -->
<context>${artifactId}</context>
</properties>
</deployable>
</deployables>
</deployer>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
<version>${springframework.version}</version>
</dependency>
<dependency>
<groupId>com.danga</groupId>
<artifactId>memcached</artifactId>
<version>2.0.1</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.5.2a</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.5.2a</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>
<version>2.1_3</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.3.GA</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>rome</groupId>
<artifactId>rome-fetcher</artifactId>
<version>1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.sawen21</groupId>
<artifactId>rss4j</artifactId>
<version>1.0.0</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jsp-api</artifactId>
<version>2.0</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>opensymphony</groupId>
<artifactId>quartz</artifactId>
<version>1.6.2</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.extremecomponents</groupId>
<artifactId>extremecomponents</artifactId>
<version>1.0.1</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<artifactId>commons-lang</artifactId>
<groupId>commons-lang</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.ce.cetag</groupId>
<artifactId>cetag</artifactId>
<version>1.0.0</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.1</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.4</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>2.0.14</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.1</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>0.9.27</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>ant</groupId>
<artifactId>ant</artifactId>
<version>1.7.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
<version>1.0</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
<version>3.2.1.ga</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>3.6.1.Final</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-spring-plugin</artifactId>
<version>2.0.11.2</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-codebehind-plugin</artifactId>
<version>2.0.11.2</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-tiles-plugin</artifactId>
<version>2.0.11.2</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.1.2</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
相关文章推荐
- maven使用cargo插件自动化(本地、远程)部署
- 利用Maven和Cargo远程部署war到Tomcat7
- cargo, maven插件cargo实现自动部署
- Eclipse利用Maven的插件部署web项目到远程tomcat服务器
- 使用cargo-maven2-plugin插件实现自动发版和远程发版
- Maven项目配置tomcat插件实现项目自动部署到远程服务器
- 利用Maven2的插件方式通过Cargo来远程部署应用到Jboss7上
- 本地环境和远程环境的maven自动部署到tomcat配置说明
- maven利用tomcat插件部署远程Linux服务器的步骤详解
- Eclipse利用Maven的插件部署web项目到远程tomcat服务器
- Cargo-maven2-plugin插件自动部署
- maven自动部署到远程tomcat教程
- 使用Maven自动部署插件
- maven自动部署插件配置
- maven 自动发布更新本地和远程仓库
- jenkins安装与配置maven+git\svn+ssh实现远程自动部署
- 非maven项目利用jenkin实现自动部署
- 思科修补本地WebEx漏洞,在AD部署中可远程利用
- 【mybatis源码学习】利用maven插件自动生成mybatis代码
- docker:(5)利用docker -v 和 Publish over SSH插件实现war包自动部署到docker