how to download external files in gradle?

前端 未结 7 533
你的背包
你的背包 2020-12-02 09:50

I have a gradle project which requires some data files available somewhere on the internet using http. The goal is that this immutable remote file is pulled once upon first

7条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-02 10:26

    Try like that:

    plugins {
        id "de.undercouch.download" version "1.2"
    }
    
    apply plugin: 'java'
    apply plugin: 'de.undercouch.download'
    
    import de.undercouch.gradle.tasks.download.Download
    
    task downloadFile(type: Download) {
        src 'http://localhost:8081/example/test-jar-test_1.jar'
        dest 'localDir'
    }
    

    You can check more here: https://github.com/michel-kraemer/gradle-download-task

    For me works fine..

提交回复
热议问题