【问题标题】:Cargo:run If you specify a containerId, you also need to specify a containerUrlCargo:run 如果指定containerId,还需要指定containerUrl
【发布时间】:2015-07-13 08:20:13
【问题描述】:

我正在尝试通过货物运行 tomcat。 Tomcat 已经安装。 cargo:deploy 工作正常,但是当我尝试 cargo:run 时出现以下错误

If you specify a containerId, you also need to specify a containerUrl.

如果我指定一个 containerURL,我会收到以下错误

[ERROR] Failed to execute goal org.codehaus.cargo:cargo-maven2-    
plugin:1.4.13:run (default-cli) on project ctm: Unable to parse configuration   
of mojo org.codehaus.cargo:cargo-maven2-plugin:1.4.13:run for parameter 
containerURL: Cannot find 'containerURL' in class org.codehaus.cargo.maven2.configuration.Container
...

这是我的 Maven 配置

<plugin>
    <groupId>org.codehaus.cargo</groupId>
    <artifactId>cargo-maven2-plugin</artifactId>
    <version>1.4.13</version>
    <configuration>
        <container>
            <type>existing</type>
            <containerId>${cargo.maven.containerId}</containerId>
             <home>${container.home}</home>
        </container>
        <configuration>
            <type>existing</type>
            <home>${container.home}</home>
        </configuration>
        <deployables>
            <deployable>
                <groupId>${project.groupId}</groupId>
                <artifactId>${project.artifactId}</artifactId>
                 <type>war</type>
                 <properties>
                     <context>example</context>
                 </properties>
             </deployable>
         </deployables>
        </configuration>
        <executions>
            <execution>
            <id>run</id>
            <configuration>
                <configuration>
                    <type>existing</type>
                </configuration>
            </configuration>
            <goals>
                <goal>run</goal>
            </goals>
        </execution>
    </executions>
</plugin>

这是我的个人资料

<profile>
    <id>developer-properties</id>
    <properties>
        <cargo.maven.containerId>tomcat7x</cargo.maven.containerId>
        <container.home>C:/apache-tomcat-7.0.35</container.home>
    </properties>
</profile>

根据货物文件;类型“existing”应该使用现有的容器安装。除非类型是“独立”,否则我认为不需要 containerURL。我不明白为什么会收到 containerURL 错误。

关于类型的文档在这里:https://codehaus-cargo.github.io/cargo/Existing+Local+Configuration.html

【问题讨论】:

  • 我认为Cannot find 'containerURL'的问题只是区分大小写的问题,试试containerUrl
  • 我仍然收到与 containerUrl 相同的错误

标签: maven tomcat tomcat7 maven-3 cargo


【解决方案1】:

我认为文档不清楚。我认为cargo:run 总是使用独立的本地配置,因此描述

如果插件配置定义了一个独立的容器 本地配置,它将创建配置。

所以它可能忽略了您现有的本地配置。

【讨论】:

  • 我最终使用 maven-antrun-plugin 来启动我现有的 tomcat 和 cargo 进行远程部署。
猜你喜欢
  • 1970-01-01
  • 2021-12-07
  • 2012-12-26
  • 2022-09-23
  • 2011-03-11
  • 2012-08-07
  • 2015-01-04
  • 1970-01-01
  • 2021-05-10
相关资源
最近更新 更多