How to upload folder contents to FTP server using Gradle

后端 未结 2 1316
时光取名叫无心
时光取名叫无心 2021-01-18 15:05

I am new to gradle and I don\'t know how to upload my /bin folder contents to the FTP server. Tried to find solution in internet, but they didn\'t help to me.

My bui

2条回答
  •  借酒劲吻你
    2021-01-18 15:41

    ftpAntTask is fairly simple to use.

    buildscript {
        repositories {
            mavenCentral()
        }
    }
    repositories{
        mavenCentral()
    }
    
    configurations {
        ftpAntTask
    }
    
    dependencies {
        ftpAntTask("org.apache.ant:ant-commons-net:1.8.4") {
            module("commons-net:commons-net:1.4.1") {
                dependencies "oro:oro:2.0.8:jar"
            }
        }
    }
    
    task ftp << {
        ant {
            taskdef(name: 'ftp',
                    classname: 'org.apache.tools.ant.taskdefs.optional.net.FTP',
                    classpath: configurations.ftpAntTask.asPath)
            ftp(server: "(removed)", userid: "(removed)", password: "(removed)", remoteDir: "(removed)") {
                fileset(dir: "(removed)") {
                    include(name: "(removed)")
                }
            }
        }
    }
    

    (This example was made from How to FTP a file from an Android Gradle build?)

提交回复
热议问题