使用cargo-maven2-plugin插件自动化发布到Tomcat服务器

Maven实战 Tomcat插件

使用cargo-maven2-plugin插件配置Tomcat本地自动发布(cargo:deploy)

<!-- 通过cargo-maven2-plugin插件配置Tomcat自动发布(cargo:deploy) -->
            <plugin>
                <!-- 指定插件名称及版本号 -->
                <groupId>org.codehaus.cargo</groupId>
                <artifactId>cargo-maven2-plugin</artifactId>
                <version>1.4.9</version>
                <!-- 插件的Tomcat6.x配置 -->
                <configuration>
                    <wait>true</wait>        <!--是否说明,操作start、stop等后续操作必须等前面操作完成才能继续 -->
                    <container>                <!-- 容器的配置 -->
                        <containerId>tomcat6x</containerId>                        <!-- 指定tomcat版本 -->
                        <type>installed</type>                                    <!-- 指定类型:standalone, installed等 -->
                        <home>E:/zhoulumin/tools/fbrp-ide-32bit/apache-tomcat-6.0.35</home>    <!-- 指定Tomcat的位置,即catalina.home -->
                    </container>
                    <configuration>            <!-- 具体的配置 -->
                        <type>existing</type>                                    <!-- 类型,existing:存在 -->
                        <home>E:/zhoulumin/tools/fbrp-ide-32bit/apache-tomcat-6.0.35</home>    <!-- Tomcat的位置,即catalina.home -->
                    </configuration>
                    <deployables>    <!-- 部署设置 -->
                        <deployable>    <!-- 部署的war包名等 -->
                            <groupId>com.chowmin.sshe</groupId>
                            <artifactId>sshe</artifactId>
                            <type>war</type>
                            <properties>
                                <context>sshe</context>    <!-- 部署路径 -->
                            </properties>
                        </deployable>
                    </deployables>
                </configuration>
                <executions>
                    <!-- 执行的动作 -->
                    <execution>
                        <id>verify-deployer</id>
                        <phase>install</phase>        <!-- 解析install -->
                        <goals>
                            <goal>deployer-deploy</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>clean-deployer</id>
                        <phase>clean</phase>
                        <goals>
                            <goal>deployer-undeploy</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

使用cargo-maven2-plugin插件配置Tomcat远程自动发布(cargo:deploy)

<!-- 通过cargo-maven2-plugin插件配置Tomcat自动发布(cargo:deploy) -->
            <plugin>
                <!-- 指定插件名称及版本号 -->
                <groupId>org.codehaus.cargo</groupId>
                <artifactId>cargo-maven2-plugin</artifactId>
                <version>1.4.9</version>
                <!-- 插件的Tomcat6.x配置 -->
                <configuration>
                    <wait>true</wait>        <!--是否说明,操作start、stop等后续操作必须等前面操作完成才能继续 -->
                    <container>                <!-- 容器的配置 -->
                        <containerId>tomcat6x</containerId>                        <!-- 指定tomcat版本 -->
                        <type>remote</type>                                    <!-- 指定类型:standalone, installed等 -->
                    </container>
                    <configuration>            <!-- 具体的配置 -->
                        <type>runtime</type>                                    <!-- 类型,existing:存在 -->
                        <properties>                                            <!-- 配置属性 -->
                            <cargo.tomcat.manager.url>http://localhost:8080/manager</cargo.tomcat.manager.url>        <!-- 管理地址 -->
                            <cargo.remote.username>zhoulumin</cargo.remote.username>                                    <!-- Tomcat用户名 -->
                            <cargo.remote.password>19880627</cargo.remote.password>                                    <!-- Tomcat密码 -->
                            <cargo.tomcat.ajp.port>8009</cargo.tomcat.ajp.port>                                        <!-- Ajp端口 -->
                        </properties>
                    </configuration>
                    <deployables>    <!-- 部署设置 -->
                        <deployable>    <!-- 部署的war包名等 -->
                            <groupId>com.chowmin.sshe</groupId>
                            <artifactId>sshe</artifactId>
                            <type>war</type>
                            <properties>
                                <context>sshe</context>    <!-- 部署路径 -->
                            </properties>
                        </deployable>
                    </deployables>
                </configuration>
                <executions>
                    <!-- 执行的动作 -->
                    <execution>
                        <id>verify-deployer</id>
                        <phase>install</phase>        <!-- 解析install -->
                        <goals>
                            <goal>deployer-deploy</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>clean-deployer</id>
                        <phase>clean</phase>
                        <goals>
                            <goal>deployer-undeploy</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

转载自:https://www.cnblogs.com/chowmin/articles/3891199.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值