Dynamically created task of type Copy is always UP-TO-DATE

前端 未结 4 603
一整个雨季
一整个雨季 2020-12-16 22:48

I\'ve prepared a very simple script, that illustrates the problem I see using Gradle 1.7 (need to stick with it because of some plugins not yet supporting newer versions).

4条回答
  •  旧时难觅i
    2020-12-16 23:36

    Putting from and into as part of the doLast section does not work. An example of a working task definitions is:

    task copyMyFile(type: Copy) {
    
        def dockerFile = 'src/main/docker/Dockerfile'
        def copyTo = 'build/docker'
    
        from dockerFile
        into copyTo
    
        doLast {
            println "Copied Docker file [$dockerFile] to [$copyTo]"
        }
    }
    

    Not the behavior I was expecting. Using gradle 3.2.1

提交回复
热议问题