maven - 如何使用 tomcat8-maven-plugin 指定另一个项目中内置的 WAR 进行集成测试?
问题描述
我有两个应用程序(Maven 'war' artifact),我们称它们Api
为Ui
.
我想设置一个完全自动化的集成测试,Api
在Ui
执行集成测试之前在本地启动。
这些应用程序是松散耦合的,因此我不想引入对Api
in Ui
s build 的任何依赖,反之亦然。
所以我想设置第三个项目,IntegratedQA
它将依赖于两个应用程序。
我的初始 POM 包含:
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat8-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<path>/</path>
</configuration>
<executions>
<execution>
<id>start-tomcat</id>
<phase>pre-integration-test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<fork>true</fork>
</configuration>
</execution>
<execution>
<id>stop-tomcat</id>
<phase>post-integration-test</phase>
<goals>
<goal>shutdown</goal>
</goals>
</execution>
</executions>
</plugin>
我的问题是......我究竟如何告诉tomcat启动Api.war
和Ui.war
,它们是在单独的项目中构建的?
解决方案
使用 tomcat7-maven-plugin 您可以自定义 tomcat7:deploy 以提供部署到 tomcat 环境中的 war 文件路径。浏览此链接以获取文档。
链接另一个stackoverflow答案,其中指定了它将如何与tomcat 8或9一起使用
推荐阅读
- html - 使用 Container 和 Columns 使用 Bootstrap 设置正确的边距/填充
- c# - 如何将字符串值从父表单发送到子表单(反之亦然)
- javascript - 我应该总是对返回承诺的函数使用 redux-saga `call` 效果吗?
- javascript - Next.js React 应用程序未显示自定义组件内容
- sql - Sequelize Many to Many Relationship using Through 不会插入额外的属性
- android - 如何将我的 Android 代码转换为 Firebase 函数的 Swift 代码?
- php - PHP - 如何根据元素的数量从内部循环打印时删除重复的数组元素
- php - 通过带有 SFTP 支持的 PHP 进行 CURL
- reactjs - redux initialState - 从其他属性中获取总数
- python - OpenCV Python对齐元素的4个角