Search code examples
mavenwarcargomaven-cargo

Cargo maven plugin - start goal ignores configuration, "run" works fine


I want cargo maven plugin to start a Tomcat7 so i put into my pom:

            <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven2-plugin</artifactId>
            <version>1.2.0</version>
            <!-- minimal configuration to let adb run (mvn package org.codehaus.cargo:cargo-maven2-plugin:run) in a local tomcat -->
            <configuration>
                <containerId>tomcat7x</containerId>
                <containerUrl>http://archive.apache.org/dist/tomcat/tomcat-7/v7.0.16/bin/apache-tomcat-7.0.16.zip
                </containerUrl>
                <configuration>
                    <properties>
                        <cargo.servlet.port>1718</cargo.servlet.port>
                    </properties>
                </configuration>
            </configuration>
        </plugin>

The Problem is if i run:

mvn package org.codehaus.cargo:cargo-maven2-plugin:run

all is working fine but if i run

mvn package org.codehaus.cargo:cargo-maven2-plugin:start

the configuration set in pom is beeing ignored:"No container defined, using a default [jetty6x, embedded] container"

you can reproduce this easily. just create an war-maven app:

mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-webapp -DarchetypeArtifactId=maven-archetype-webappp

Then add the code above to pom and run both commands.

So how to set ContainerId and Url properly for goal start -- Am I missing something?!


Solution

  • so i contacted cargo support. the configuration above works indeed only with run goal, but there is also a configuration that works with both (the cargo doc is somehow misguiding):

    <plugin>
        <groupId>org.codehaus.cargo</groupId>
        <artifactId>cargo-maven2-plugin</artifactId>
        <version>1.2.0</version>
        <!-- minimal configuration to let adb run (mvn package org.codehaus.cargo:cargo-maven2-plugin:run) in a local tomcat -->
        <configuration>
          <container>
            <containerId>tomcat7x</containerId>
            <zipUrlInstaller>
              <url>http://archive.apache.org/dist/tomcat/tomcat-7/v7.0.16/bin/apache-tomcat-7.0.16.zip</url>
            </zipUrlInstaller>
          </container>
          <configuration>
            <properties>
              <cargo.servlet.port>1718</cargo.servlet.port>
            </properties>
          </configuration>
        </configuration>
      </plugin>
    

    notice the additional container and zipUrlInstaller tag instead of containerUrl.