【发布时间】:2022-01-13 07:30:08
【问题描述】:
在执行我的测试场景之前,我需要在预集成阶段运行 2 个应用程序(作为 WAR 文件)。 我已经像这样配置了 maven cargo 插件:
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven3-plugin</artifactId>
<version>1.9.8</version>
<executions>
<execution>
<id>neo-start-lanceur</id>
<phase>pre-integration-test</phase>
<configuration>
<container>
<containerId>tomcat8x</containerId>
<artifactInstaller>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat</artifactId>
<version>8.5.9</version>
</artifactInstaller>
</container>
<configuration>
<properties>
<cargo.servlet.port>8081</cargo.servlet.port>
<spring.profiles.active>tdc</spring.profiles.active>
<JAVA_OPTS>-Xms512m -Xmx1536m -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=70</JAVA_OPTS>
</properties>
<home>${project.build.directory}/neo-lanceur</home>
</configuration>
<deployables>
<deployable>
<groupId>fr.cnp.neo</groupId>
<artifactId>neo-web-lanceur</artifactId>
<type>war</type>
</deployable>
</deployables>
</configuration>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>neo-stop-lanceur</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
<execution>
<id>neo-start-webapp</id>
<phase>pre-integration-test</phase>
<configuration>
<container>
<containerId>tomcat8x</containerId>
<artifactInstaller>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat8</artifactId>
<version>8.5.9</version>
</artifactInstaller>
</container>
<configuration>
<properties>
<cargo.servlet.port>8080</cargo.servlet.port>
<spring.profiles.active>tdc</spring.profiles.active>-->
<JAVA_OPTS>-Xms512m -Xmx1536m -XX:MinHeapFreeRatio=20 -XX:MaxHeapFreeRatio=70</JAVA_OPTS>
</properties>
<home>${project.build.directory}/neo-webapp</home>
<configfiles>
<configfile>
<file>${project.basedir}/../web/src/test/conf/neo.properties</file>
<todir>webapps/neo-web/WEB-INF</todir>
</configfile>
</configfiles>
</configuration>
<deployables>
<deployable>
<groupId>fr.cnp.neo</groupId>
<artifactId>neo-web</artifactId>
<type>war</type>
</deployable>
</deployables>
</configuration>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>neo-stop-webapp</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
但它只部署和运行第一个应用程序。
是否可以在单个 tomcat 实例上部署 2 个 WAR 或创建 2 个本地容器?
感谢您的帮助!!
【问题讨论】:
标签: maven maven-cargo