cargocargo-maven2-plugin

cargo-maven2-plugin:start fails with "Actually there are no valid types registered for this configuration", regardless of what containerId I enter


I'm trying to run integration tests with the cargo-maven2-plugin and Tomcat 8. I want the Maven build to start the container for me, so I have configured the start and stop goals as documented here. The problem is that regardless of what I enter as containerId, the start goal always fails with a message saying that there are no registered configurations. The error messages always ends in

Actually there are no valid types registered for this configuration. Maybe you've made a mistake spelling it?

I've tried various configurations, including ones that I found in various tutorials, and ones that user older Tomcat versions, but nothing helps. The error message is always the same.

Other posts here on Stack Overflow recommend to update the Cargo versions, but this doesn't apply to my problem: I already use the latest release version (1.6.5).

So, why do I keep getting this error?


For reference, here is one complete configuration that I tried out:

<plugin>
    <groupId>org.codehaus.cargo</groupId>
    <artifactId>cargo-maven2-plugin</artifactId>
    <version>1.6.5</version>
    <executions>
        <execution>
            <id>start-container</id>
            <phase>pre-integration-test</phase>
            <goals>
                <goal>start</goal>
            </goals>
        </execution>
        <execution>
            <id>stop-container</id>
            <phase>post-integration-test</phase>
            <goals>
                <goal>stop</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <container>
            <containerId>tomcat8x</containerId>
            <artifactInstaller>
                <groupId>org.apache.tomcat</groupId>
                <artifactId>tomcat</artifactId>
                <version>8.5.23</version>
            </artifactInstaller>
        </container>
        <configuration>
            <type>standalone</type>
        </configuration>
        <deployables>
            <!-- ... -->
        </deployables>
    </configuration>
</plugin>

The full error message for this configuration is:

[ERROR] Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.6.5:start (start-container) on project domain.db.itest: Execution start-container of goal org.codehaus.cargo:cargo-maven2-plugin:1.6.5:start failed: Cannot create configuration. There's no registered configuration for the parameters (container [id = [tomcat8x], type = [installed]], configuration type [standalone]). Actually there are no valid types registered for this configuration. Maybe you've made a mistake spelling it? -> [Help 1]


Solution

  • The solution was incredibly simple: I had the offline mode enabled. Without offline mode, Cargo downloaded the cargo-core-container-tomcat artifact, and apparently this artifact contains the definition of the tomcat8x configuration. Then, the container start was successful!

    I had started the Maven build from Eclipse, so I didn't notice that the offline mode was enabled. I'm aware that this situation is quite special, but maybe someone else still benefits from my insight. It took me a while to solve, so I'm sharing problem and solution here. (After all, this is encouraged :-)

    I got the key hint from a mailing list post, where thecargo-core-container-tomcat artifact was not downloaded due to a Nexus repository configuration.