简体   繁体   中英

Cargo maven plugin - cannot deploy local war - “Artifact is not a dependency of the project”

I would like to use cargo maven plugin (cargo-maven2-plugin) for this scenario:

  • I have selenium test framework (ProjectT), containing core, page objects and some steps used for UI testing of ProjectA. For this framework exists some integration tests (selenium smoke tests) to verify its validity.
  • The goal is to run local embedded jetty server via cargo, deploy war (from local repo) with ProjectA into it and then run integration tests from ProjectT against this running ProjectA

But I am getting trouble to deploy ProjectA war using cargo.

There is plugin configuration inside my 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>

run from ProjectT:

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

ERROR message:

[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]

artifact with builded war exists in my local repo (was previously built). I also tried add it as a dependency

Please, could you help me what I am missing? Why is not a dependecy?

Probably, your artifact ID was wrong because of parent-child hierarchy.

If your parent is: com.mefi -> project-root

Your deployable should be com.mefi -> project-a

you need to specify the type of the deployer so above deployable put this

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM