Cargo maven插件 - 无法部署本地战争 - "工件不是项目的依赖关系"

时间:2015-12-30 16:14:04

标签: maven maven-3 pom.xml maven-cargo cargo-maven2-plugin

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

  • 我有selenium测试框架(ProjectT),包含核心,页面对象和用于ProjectA的UI测试的一些步骤。对于这个框架,存在一些集成测试(硒烟雾测试)以验证其有效性。
  • 目标是通过货运运行本地嵌入式码头服务器,使用ProjectA将war(从本地仓库)部署到其中,然后针对此运行的ProjectA运行ProjectT的集成测试

但是我在使用货物部署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]

在我的本地仓库(以前建造的)中存在

有建筑战争的工件。我也尝试将其添加为依赖

拜托,你能帮我解决一下我失踪的事吗?为什么不依赖?

2 个答案:

答案 0 :(得分:0)

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

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

您的可部署性应为com.mefi -> project-a

答案 1 :(得分:0)

您需要指定部署者的类型,以便可以部署这个

<deployer>
<type>war</type>
</deployer>
<deployables>
<deployable>
相关问题