configurations { sshAntTask } dependencies { sshAntTask 'org.apache.ant:ant-jsch:1.9.4', 'com.jcraft:jsch:0.1.51' } ant.taskdef(name: 'scp', classname: 'org.apache.tools.ant.taskdefs.optional.ssh.Scp', classpath: configurations.sshAntTask.asPath) ant.taskdef(name: 'sshexec', classname: 'org.apache.tools.ant.taskdefs.optional.ssh.SSHExec', classpath: configurations.sshAntTask.asPath) // SCP ant.scp(file: "file-to-transfer.zip", todir: 'kwon37xi@hostname:/home/kwon37xi/dir', keyfile: '${user.home}/.ssh/id_rsa', // ${user.home}은 ant 변수임. 홑따옴표주의! passphrase: 'passphrase', verbose: true) // SSHEXEC ant.sshexec( host: 'hostname', username: 'kwon37xi', trust: 'true', keyfile: '${user.home}/.ssh/id_rsa', // ${user.home}은 ant 변수임. 홑따옴표주의! passphrase: 'passphrase', verbose: true, command: "ls -la /usr/bin" )
ant.properties
에 저장할 수 있다. outputproperty: 'outputPropertyName
' 처럼 값을 저장하면, 그 결과를 ant.properties.outputPropertyName
으로 접근 가능해진다.