SCP with Groovy and Antbuilder

This example shows the usage of the ant scp task with the AntBuilder.


The following snippet will download the remote /tmp/file.txt to the home folder of the local user.

def ant = new AntBuilder()
ant.scp(file:'user@host:/tmp/file.txt',
	todir:"/home/localuser/",
	verbose:true,
	keyfile:"/home/localuser/.ssh/id_dsa",
	passphrase:"password")

You will need the ant-jsch.jar and jsch-0.1.33.jar in your classpath.