How to copy to multiple destinations with Gradle copy task?

前端 未结 5 1164
陌清茗
陌清茗 2020-12-05 04:02

I am trying to copy one file to multiple destinations through a Gradle task. I found the following in other websites but I get an ERROR while running this task.



        
5条回答
  •  隐瞒了意图╮
    2020-12-05 04:42

    If you really want them in one task, you do something like this:

    def filesToCopy = copySpec {
      from 'someFile.jar'
      rename { 'anotherfile.jar' }
    }
    
    task copyFiles << {
      ['dest1', 'dest2'].each { dest ->
        copy {
          with filesToCopy
          into dest
        }
      }
    }
    

提交回复
热议问题