使用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

猜你喜欢

转载自blog.csdn.net/qq_24644517/article/details/78664370