动态任务

所谓动态任务,就是动态生成task,举例如下

4.times{counter->
    task "hello6$counter"<<{
        println("Hello World6$counter")
    }

}
zhangliuningdeMacBook-Pro:learning-gradle-demo01 sherry$ gradle -q hello61
Hello World61
zhangliuningdeMacBook-Pro:learning-gradle-demo01 sherry$ gradle -q hello62
Hello World62

上述就生成了四个task任务

原文地址:https://www.cnblogs.com/sherrykid/p/5926451.html