Cargo Maven on Remote Server

1.1k views Asked by At

I am trying to use cargo maven plugin to run a war on a remote server, but I get: [ERROR] Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.6.4:start (start-container) on project portnet: Only local containers can be started -> [Help 1]

I have the configuration bellow:

          <plugin>
             <groupId>org.codehaus.cargo</groupId>
             <artifactId>cargo-maven2-plugin</artifactId>
             <version>1.6.4</version>
             <configuration>
             <wait>false</wait>
               <container>
                  <containerId>tomcat8x</containerId>
                  <type>remote</type>                 
               </container>

               <configuration>
                  <type>runtime</type>
                     <files>
                        <copy>
                           <file>C:\apache-tomcat-8.5.20\conf\tomcat-users.xml</file>
                           <tofile>conf/tomcat-users.xml</tofile>
                           <configfile>true</configfile>
                           <overwrite>true</overwrite>
                        </copy>
                     </files>
                     <properties>
                        <cargo.hostname>remoteserver</cargo.hostname>
                        <cargo.servlet.port>8180</cargo.servlet.port>
                        <cargo.remote.username>user</cargo.remote.username>
                        <cargo.remote.password>passw</cargo.remote.password>                           <cargo.tomcat.manager.url>http://localhost:8180/manager</cargo.tomcat.manager.url>
                </properties>
                </configuration>

            <deployer>
                <type>remote</type>                 
            </deployer>

            <deployables>
                <deployable>
                   <type>war</type>
                   <properties>
                          <context>/portnet</context>
                    </properties>    
            </deployable>
            </deployables>

        </configuration>

            <executions>
              <!-- start server before integration tests -->
              <execution>
                <id>start-container</id>
                <phase>pre-integration-test</phase>
                <goals>
                  <goal>start</goal>
                </goals>
              </execution>
              <!-- stop server after integration tests -->
              <execution>
                <id>stop-container</id>
                <phase>post-integration-test</phase>
                <goals>
                  <goal>stop</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
    </plugins>
1

There are 1 answers

0
Karel Suta On

If you want to work with remote server then there are these two Cargo goals which you can use:

  • deploy - This goal is used for deploying of defined deployables to remote server.
  • undeploy - This goal is used for undeploying of defined deployables from remote server.

Goals start and stop can be used just for local containers - containers whose lifecycle is directly controlled by Cargo Maven plugin.

If you replace <goal>start</goal> in your configuration with <goal>deploy</goal> and <goal>stop</goal> with <goal>undeploy</goal> then you should get rid of this error.