How to upload folder contents to FTP server using Gradle

后端 未结 2 1318
时光取名叫无心
时光取名叫无心 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:51

    Use apache commons net library. There's an example of FTPClient usage.

    You also need to configure dependencies for the build script itself. Following code does it:

    import org.apache.commons.net.ftp.FTPClient
    
    buildscript {
        repositories {
            mavenCentral()
        }
    
        dependencies {
            classpath 'commons-net:commons-net:3.3'
        }
    }
    
    task upload << {
         def ftp = new FTPClient()
         //following logic..
    }
    

提交回复
热议问题