1

我正在尝试cargo在我的 servlet 项目中配置自动部署,并且我在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。

4

2 回答 2

5

根据文档“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>
于 2013-08-05T15:17:50.743 回答
0

I noted that you write

How ${groupId} and ${artifactId} would be resolved ?!! Please try with static groupId and artifactId for the war app

 <deployer>
        <type>remote</type>
        <deployables>
            <deployable>
                <groupId>${groupId}</groupId>
                <artifactId>${artifactId}</artifactId>
                <type>war</type>
                <properties>
                    <context>latest</context>
                </properties>
            </deployable>
        </deployables>
    </deployer>
于 2013-08-05T15:22:18.543 回答