通过这几天的学习,终于学会了自动化部署,Cargi自动化部署是一组帮助用户操作WEB容器的工具,它能够帮助用户实现自动化部署,而且它几乎支持所有容器
,Tomcat、JBoss,jetty服务器。本文章主要是基于Tomcat部署。在这里是基于Jenkins进行持续集成,Jenkins是最流行的开源持续集成服务软件,相关可见Jenkis文档。
本文介绍是maven+git+jenkis
<!-- 自动化部署 -->
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.4.5</version>
<executions>
<execution>
<id>start-container</id>
<phase>install</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<configuration>
<wait>false</wait>
<container>
<containerId>tomcat8x</containerId>
<zipUrlInstaller>
<url>https://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-8/v8.0.36/bin/apache-tomcat-8.0.36.tar.gz</url>
<downloadDir>${project.build.directory}/downloads</downloadDir>
<extractDir>${project.build.directory}/extracts</extractDir>
</zipUrlInstaller>
<home>${project.build.directory}/extracts/apache-tomcat-8.0.36/apache-tomcat-8.0.36</home>
</container>
<configuration>
<type>standalone</type>
<home>${project.build.directory}/tomcat8x</home>
<properties>
<cargo.servlet.port>8084</cargo.servlet.port>
<cargo.tomcat.ajp.port>8098</cargo.tomcat.ajp.port>
<cargo.hostname>localhost</cargo.hostname>
<cargo.rmi.port>8206</cargo.rmi.port>
<cargo.tomcat.uriencoding>${project.build.sourceEncoding}</cargo.tomcat.uriencoding>
</properties>
</configuration>
</configuration>
</plugin>