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

Cargo maven插件-无法部署本地战争-“;工件不是项目的依赖项;,maven,maven-3,pom.xml,maven-cargo,cargo-maven2-plugin,Maven,Maven 3,Pom.xml,Maven Cargo,Cargo Maven2 Plugin,我想在这个场景中使用cargo-maven插件(cargo-maven2-plugin): 我有selenium测试框架(ProjectT),包含核心、页面对象和一些用于ProjectA UI测试的步骤。对于该框架,存在一些集成测试(selenium smoke测试)来验证其有效性 目标是通过cargo运行本地嵌入式jetty服务器,将带有ProjectA的war(来自本地repo)部署到其中,然后针对运行中的ProjectA运行ProjectT的集成测试 但我很难用货物发动战争 我的Pro

我想在这个场景中使用cargo-maven插件(cargo-maven2-plugin):

  • 我有selenium测试框架(ProjectT),包含核心、页面对象和一些用于ProjectA UI测试的步骤。对于该框架,存在一些集成测试(selenium smoke测试)来验证其有效性
  • 目标是通过cargo运行本地嵌入式jetty服务器,将带有ProjectA的war(来自本地repo)部署到其中,然后针对运行中的ProjectA运行ProjectT的集成测试
但我很难用货物发动战争

我的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>

[…]
com.mefi
项目a
1.0-快照
战争
[...]
[...]
org.codehaus.cargo
cargo-maven2-plugin
1.4.17
码头7X
嵌入的
com.mefi
项目a
战争
8080
com.mefi
项目a
战争
启动服务器
预集成测试
开始
停止服务器
整合后测试
停止

从ProjectT运行:

mvn org.codehaus.cargo:cargo-maven2-plugin:run-Dcargo.servlet.port=9000

错误消息:

[ERROR]无法执行目标org.codehaus.cargo:cargo-maven2-plugin:1.4.17:在项目airtest selenium:Artifact[com.mefi:project-a:war]上运行(默认cli)不是项目的依赖项。->[帮助1]

我的本地repo(以前构建的)中存在构建了war的工件。我还尝试将其添加为依赖项


求求你,你能帮我找到我缺少的东西吗?为什么不是依赖

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

如果您的家长是:
com.mefi->project root


您的可部署程序应该是
com.mefi->project-a

您需要指定部署程序的类型,以便将其置于可部署程序之上

<deployer>
<type>war</type>
</deployer>
<deployables>
<deployable>

战争

关于
mvn clean verify
@khmarbaise:您好,这给了我相同的错误消息,关于工件不是项目的依赖项假设您有一个多模块构建?如果是的话,你能添加你创建的结构和你给Maven打电话的地方吗…@khmarbaise谢谢你的关注,我不知道为什么,但它开始起作用了。我找不到是什么修改导致了它,或者maven cache等出现了问题,但它现在可以工作了。我不能再复制它了。所以这个问题不再有意义了。再次感谢。@mefi我和你在同一点上被击中,因为货物抛出了同样的错误。你能告诉我你是如何解决这个问题的吗?