0

我想在这种情况下使用 cargo maven 插件(cargo-maven2-plugin):

  • 我有 selenium 测试框架 (ProjectT),包含核心、页面对象和一些用于 ProjectA 的 UI 测试的步骤。对于这个框架,存在一些集成测试(硒烟雾测试)来验证其有效性。
  • 目标是通过 cargo 运行本地嵌入式码头服务器,将带有 ProjectA 的战争(来自本地 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]

我的本地仓库中存在构建战争的工件(以前构建过)。我也尝试将其添加为依赖项

拜托,你能帮我解决我所缺少的吗?为什么不是依赖?

4

2 回答 2

0

你需要指定部署器的类型,所以在可部署的上面放这个

<deployer>
<type>war</type>
</deployer>
<deployables>
<deployable>
于 2017-12-29T12:50:22.640 回答
0

由于父子层次结构,您的工件 ID 可能是错误的。

如果你的父母是:com.mefi -> project-root

你的可部署应该是com.mefi -> project-a

于 2016-11-27T19:04:57.810 回答