Gradle FTP

ant ftp task 사용.

repositories {
    mavenCentral()
}
 
configurations {
    ftpAntTask
}
 
dependencies {
    ftpAntTask "org.apache.ant:ant-commons-net:1.9.4"
}
 
ext {
    ftpServer = 'localhost'
    ftpPort = 21
    ftpUserId = 'someuser'
    ftpPassword = 'passw@rd'
    ftpRemoteDir = 'remote/target/dir'
}
 
task ftpUpload << {
    ant {
        taskdef(name: 'ftp',
                classname: 'org.apache.tools.ant.taskdefs.optional.net.FTP',
                classpath: configurations.ftpAntTask.asPath) // 여기서 추가된 클래스패스 사용!
            ftp(server: ftpServer,
                port: ftpPort,
                remotedir: ftpRemoteDir,
                userid: ftpUserId,
                password: ftpPassword,
                depends: "yes",
                verbose: "yes",
                binary: "yes") {
 
                fileset(dir: "local/dir")
            }
    }
}