我想在这种情况下使用cargo-maven2-plugin插件:
- 我有selenium测试框架(ProjectT),包含核心、页面对象和一些用于ProjectA UI测试的步骤。对于该框架,存在一些集成测试(硒烟雾测试)来验证其有效性
- 目标是通过货物运行本地嵌入式jetty服务器,在其中部署带有ProjectA的war(来自本地repo),然后从ProjectT针对正在运行的ProjectA运行集成测试
但我在使用货物部署ProjectA战争时遇到了麻烦。
我的ProjectT pom:中有插件配置
[...]
<dependencies>
<dependency>
<groupId>com.mefi</groupId>
<artifactId>project-a</artifactId>
<version>1.0-SNAPSHOT</version>
<type>war</type>
</dependency>
[...]
<dependencies>
[...]
<plugins>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.4.17</version>
<configuration>
<!-- Container definition -->
<container>
<containerId>jetty7x</containerId>
<type>embedded</type>
<dependencies>
<dependency>
<groupId>com.mefi</groupId>
<artifactId>project-a</artifactId>
<type>war</type>
</dependency>
</dependencies>
</container>
<configuration>
<properties>
<cargo.servlet.port>8080</cargo.servlet.port>
</properties>
</configuration>
<deployables>
<deployable>
<groupId>com.mefi</groupId>
<artifactId>project-a</artifactId>
<type>war</type>
</deployable>
</deployables>
</configuration>
<!-- Setting for container starting/stoping during phases. -->
<executions>
<execution>
<id>start-server</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>stop-server</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
从ProjectT:运行
mvn org.codehaus.cargo: cargo-maven2-plugin:run -Dcargo.servlet.port=9000
错误消息:
[ERROR] Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.4.17:run (default-cli) on project airtest-selenium: Artifact [com.mefi:project-a:war] is not a dependency of the project. -> [Help 1]
带有构建战争的工件存在于我的本地repo中(以前是构建的)。我还尝试将其添加为依赖
求你了,你能帮我找不到什么吗?为什么不是依赖?
可能是因为父子层次结构,您的工件ID错误。
如果您的父母是:com.mefi -> project-root
您的可部署应该是com.mefi -> project-a
您需要指定部署程序的类型,以便在上面部署这个
<deployer>
<type>war</type>
</deployer>
<deployables>
<deployable>