Tag Archives: SCP

Maven – Run sshexec and scp in maven-antrun-plugin

If you want to use the <sshexec> or <scp> tasks in the maven-antrun-plugin, you may find the following error.

  • [ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.3:run (default-cli) on project fraudcheck: An Ant BuildException has occured…


Just like what we have discussed in Apache Ant – Using scp and sshexec tasks in build.xml, you need to define the <sshexec> or <scp> tasks in the Ant script. Try to configure your pom.xml as follow.

<!-- Deployment using Ant -->
    <!-- Include Ant-Contrib tasks -->
    <!-- Include sshexec task -->
      <!-- Add the sshexec and scp task -->
      <taskdef name="sshexec"
        classpathref="maven.plugin.classpath" />
      <taskdef name="scp"
        classpathref="maven.plugin.classpath" />

      <!-- Rest of the Ant script -->


Done =)


Apache Ant – Using scp and sshexec tasks in build.xml

Unlike the Ant Contrib library which could be included thru the <taskdef>, the <scp> and <sshexec> tasks could not be included in this way or it will throw the following errors.

  • A class needed by class org.apache.tools.ant.taskdefs.optional.ssh.Scp
    cannot be found: com/jcraft/jsch/…


If you want to make use of the SCP protocol to do file transfer in Apache Ant, first, visit JCraft and download the jsch-0.1.50.jar.

There are 2 ways to enable the <scp> and <sshexec> tasks in the Ant build.xml.
Continue reading Apache Ant – Using scp and sshexec tasks in build.xml