结合使用Cargo和Maven,无需HOT部署即可远程部署WAR

Cra*_*tis 4 java tomcat cargo maven

我们在构建服务器上将Cargo与Maven结合使用,以将WAR文件从构建服务器远程部署到内部质量检查服务器以进行测试。

我们当前用于该项目的POM如下所示,并且可以在热部署中正常工作。

问题在于,我们希望让Cargo插件停止Tomcat实例,部署新的WAR,然后启动Tomcat ,而不是热部署。有没有办法更改POM来管理这种情况?

我们的Maven构建定义为:

mvn clean deploy ... cargo:redeploy
Run Code Online (Sandbox Code Playgroud)

以及POM中的cargo插件设置:

                  <plugin>
                        <groupId>org.codehaus.cargo</groupId>
                        <artifactId>cargo-maven2-plugin</artifactId>
                        <configuration>
                            <container>
                                <containerId>tomcat7x</containerId>
                                <type>remote</type>
                                <systemProperties>
                                    <cargo.jvmargs>-XX:MaxPermSize=256M -Xmx1024m</cargo.jvmargs>
                                </systemProperties>
                            </container>
                            <configuration>
                                <type>runtime</type>
                                <properties>
                                    <cargo.hostname>qa-server</cargo.hostname>
                                    <cargo.servlet.port>8080</cargo.servlet.port>
                                    <cargo.tomcat.manager.url>http://qa-server:8080/manager</cargo.tomcat.manager.url>
                                    <cargo.remote.username>username</cargo.remote.username>
                                    <cargo.remote.password>pass</cargo.remote.password>
                                </properties>
                            </configuration>
                            <deployer>
                                <type>remote</type>
                                <deployables>
                                    <deployable>
                                        <groupId>com.ourcompany</groupId>
                                        <artifactId>myapp-artifactId</artifactId>
                                        <type>war</type>
                                        <properties>
                                            <context>latest</context>
                                        </properties>
                                    </deployable>
                                </deployables>
                            </deployer>
                        </configuration>
                    </plugin>
Run Code Online (Sandbox Code Playgroud)

unl*_*udo 5

我们在货运方面遇到困难。片刻之后,tomcat卡住并且无法重新启动。货物不允许启动/停止雄猫。

因此,我们最终要做的是放弃货物,并使用脚本在距詹金斯机器很远的地方重新启动tomcat。另外,我们在用于部署战争的集成机上共享一个文件夹。我们还将conf文件和文件夹用于maven程序集插件。