Search code examples
mavencargoautodeployjonas

Maven Cargo deployment to remote JONAS fails on already autoloaded war


Here is the sequence of actions that leads to deployment failure :

  • I deploy for the first time a war called xxx.war, through Cargo, to a remote JONAS 4.7.4. It succeeds, and put my war in webapps directory.
  • I try to redeploy this war through Cargo to update it : no problem, it succeeds.
  • I shutdown JONAS and start it. My JONAS is configured to autodeploy war that are in webapps directory. So my xxx.war is automatically deployed by JONAS.
  • I try to redeploy a new version of this war through Cargo : this is a failure. When a war has been autodeployed by JONAS, I just can't redeploy it by Maven Cargo.

If JONAS is not in autodeploy mode, there is no problem in redeploying a new version of the war through Cargo after a restart of JONAS.

Any ideas ?


Solution

  • Finally I don't use cargo anymore.

    Instead I do deployment through antrun plugin, and it works very well.

    I have put JONAS in autodeploy mode.

            <plugin>
             <artifactId>maven-antrun-plugin</artifactId>
             <configuration>
                <tasks>
                    <scp 
                        file="${project.basedir}/target/${war.warName}.war"
                        todir="${scp.finalDir}" 
                        trust="true" 
                        failonerror="true"/>
                </tasks>
             </configuration>
             <executions>
                    <execution>
                          <id>copy-war-to-server</id>
                          <phase>install</phase>
                          <goals>
                                 <goal>run</goal>
                          </goals>
                    </execution>
             </executions>
           <dependencies>
          <dependency>
            <groupId>ant</groupId>
            <artifactId>ant-jsch</artifactId>
            <version>1.6.5</version>
          </dependency>
          <dependency>
            <groupId>com.jcraft</groupId>
            <artifactId>jsch</artifactId>
            <version>0.1.42</version>
          </dependency>
        </dependencies>
       </plugin>