【问题标题】:maven - Failed to execute cargo:startmaven - 无法执行货物:开始
【发布时间】:2013-08-06 08:18:50
【问题描述】:

我正在尝试在我的 servlet 项目中配置 cargo 自动部署,我在 pom.xml 文件中有这些:

    <dependency>
      <groupId>org.codehaus.cargo</groupId>
      <artifactId>cargo-core-api-module</artifactId>
      <version>1.4.3</version>
    </dependency>
     <!--
     <dependency>
       <groupId>org.codehaus.cargo</groupId>
       <artifactId>cargo-core-container-tomcat</artifactId>
       <version>1.4.2-SNAPSHOT</version>
    </dependency>
        -->     
    <dependency>         
        <groupId>org.codehaus.cargo</groupId>
        <artifactId>cargo-maven2-plugin</artifactId>
        <version>1.4.2</version>
    </dependency>
    <build>
     <plugins>
       <!-- cargo plugin  -->
  <plugin>
    <groupId>org.codehaus.cargo</groupId>
    <artifactId>cargo-maven2-plugin</artifactId>
    <configuration>
        <container>
            <containerId>tomcat6x</containerId>
            <type>remote</type>
            <systemProperties>
                <cargo.jvmargs>-XX:MaxPermSize=256M -Xmx1024m</cargo.jvmargs>
            </systemProperties>
        </container>
        <configuration>
            <type>runtime</type>
            <properties>
                <cargo.hostname>${remote.hostname}</cargo.hostname>
                <cargo.protocol>${remote.protocol}</cargo.protocol>
                <cargo.servlet.port>9000</cargo.servlet.port>
                <cargo.tomcat.manager.url>http://localhost:9000/manager</cargo.tomcat.manager.url>
                <cargo.remote.username>user</cargo.remote.username>
                <cargo.remote.password>pass</cargo.remote.password>
            </properties>
        </configuration>
        <deployer>
            <type>remote</type>
            <deployables>
                <deployable>
                    <groupId>${groupId}</groupId>
                    <artifactId>${artifactId}</artifactId>
                    <type>war</type>
                    <properties>
                        <context>latest</context>
                    </properties>
                </deployable>
            </deployables>
        </deployer>
    </configuration>
</plugin>
<!-- End cargo plugin -->
     </plugins>
     <build>>

当我尝试通过 mvn clean cargo:start 启动货物时,我得到 BUILD FAILURE:

[ERROR] Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.4.3:start (default-cli) on project my-app: Unable to parse configuration of mojo org.codehaus.cargo:cargo-maven2-plugin:1.4.3:start for parameter deployables: Cannot find 'deployables' in class org.codehaus.cargo.maven2.configuration.Deployer -> [Help 1]

有什么想法吗? tnx。

【问题讨论】:

  • 请在此处发布您的货物插件配置/执行,看起来您在该配置中拼错了一个参数
  • @Jk1 我更新了pom.xml 文件

标签: java maven servlets deployment cargo


【解决方案1】:

我注意到你写的

${groupId} 和 ${artifactId} 将如何解决?!! 请尝试使用静态 groupId 和 artifactId 作为战争应用程序

 <deployer>
        <type>remote</type>
        <deployables>
            <deployable>
                <groupId>${groupId}</groupId>
                <artifactId>${artifactId}</artifactId>
                <type>war</type>
                <properties>
                    <context>latest</context>
                </properties>
            </deployable>
        </deployables>
    </deployer>

【讨论】:

    【解决方案2】:

    根据documentation“deployer”元素不能包含“deployables”子元素。为了使事情正常工作,您应该将“deployables”放在“configuration”元素下

    <configuration>
          <container>
            [...]
          </container>
          <configuration>
            <type>standalone</type>
            [...]
          </configuration>
          <deployables>
            <deployable>
              <groupId>my.war.groupId</groupId>
              <artifactId>my-war</artifactId>
              <type>war</type>
            </deployable>
          </deployables>
        </configuration>
    

    【讨论】:

      猜你喜欢
      • 2016-04-07
      • 2013-04-06
      • 1970-01-01
      • 1970-01-01
      • 2015-04-10
      • 2016-02-25
      • 1970-01-01
      • 2021-10-09
      • 2014-09-06
      相关资源
      最近更新 更多