mavenpluginsdeploymentcargo

Cargo Maven2 Plugin - Change Target Filename on Remote Type


I recently started using the cargo-maven2-plugin (org.codehaus.cargo) to deploy a WAR artifact to a remote server and it appears to work great, with one exception. I can't seem to figure out a way to specify the name of the target file once it is copied to the remote server. For example, the artifact that is built has the name "my-war-artifact-2013.10.war" but when it gets deployed to the server I want it to be deployed as "my-war-artifact.war".

All of the documentation states it can be done but only when using a local type. Has anyone done this or figured out a way to do this?? I desperately need this capability! Below is the relevant portion of my POM...

<plugin>
  <groupId>org.codehaus.cargo</groupId>
  <artifactId>cargo-maven2-plugin</artifactId>
  <executions>
    <execution>
      <id>deploy</id>
      <phase>package</phase>
      <goals>
        <goal>deployer-redeploy</goal>
      </goals>
    </execution>
  </executions>
  <configuration>
    <container>
      <containerId>tomcat7x</containerId>
      <type>remote</type>
    </container>
    <configuration>
      <type>runtime</type>
      <properties>
        <cargo.remote.username>${tomcat.username}</cargo.remote.username>
        <cargo.remote.password>${tomcat.password}</cargo.remote.password>
        <cargo.tomcat.manager.url>
          http://${host}${port}/manager
        </cargo.tomcat.manager.url>
      </properties>
    </configuration>
  </configuration>
</plugin>

Solution

  • In the cargo configuration add:

    ...
    <deployables>
        <deployable>
            <groupId>${project.groupId}</groupId>
            <artifactId>${project.artifactId}</artifactId>
            <type>war</type>
            <properties>
                <context>my-war-artifact</context>
            </properties>
        </deployable>
    </deployables>
    

    I used this currently in combination with the TomEE and the target filename copied into webapps was the name enclosed by the context-tag added by the suffix "war".