cargo-maven2-plugin:start 失败并显示 "Actually there are no valid types registered for this configuration",无论我输入什么 containerId

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

我正在尝试 运行 与 cargo-maven2-plugin 和 Tomcat 的集成测试 8. 我希望 Maven 构建为我启动容器,所以我配置了 startstop 记录的目标 here。问题是,无论我输入什么 containerIdstart 目标总是失败,并显示一条消息说没有已注册的配置。错误消息总是以

结尾

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

我尝试了各种配置,包括我在各种教程中找到的配置,以及使用旧 Tomcat 版本的配置,但没有任何帮助。错误信息总是一样的。

Stack Overflow 上的其他帖子建议更新 Cargo 版本,但这不适用于我的问题:我已经使用 latest release version (1.6.5)。

那么,为什么我总是收到此错误?


作为参考,这是我尝试过的一个完整配置:

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

此配置的完整错误消息是:

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

解决方案非常简单:我启用了离线模式。在没有离线模式的情况下,Cargo 下载了 cargo-core-container-tomcat 工件,显然这个工件包含 tomcat8x 配置的定义。那么,容器启动成功了!

我已经从 Eclipse 启动了 Maven 构建,所以我没有注意到启用了离线模式。我知道这种情况很特殊,但也许其他人仍会从我的见解中受益。我花了一段时间才解决,所以我在这里分享问题和解决方案。 (毕竟,这是值得鼓励的:-)

我从 mailing list post 那里得到了关键提示,其中 cargo-core-container-tomcat 工件由于 Nexus 存储库配置而未下载。

此错误有时是由于 cargo 插件版本所致。将您的货物插件更新到更高或最新版本。 就我而言,我从 cargo 1.4.8 更新到 cargo 1.7.0.

检查这个 link,它可能有帮助: click here