在gradle中创建任务的语法

时间:2019-01-20 09:33:34

标签: gradle groovy

this official doc描述了如何在gradle中定义任务,例如:

task helloTask {
   println 'Hello World!'
}

看来这段代码实际上意味着一个方法调用,即Task task(String name, Closure configureClosure)

由于这是一个方法调用,因此helloTask应该是name类型的参数String。那么‘’""在哪里?

ps。

顺便说一句,括号与标准的常规方法调用看起来有所不同。

1 个答案:

答案 0 :(得分:0)

我认为它应该看起来像这样:

task mytask(group:'mygroup', description:"my own simple task") {

    println 'this will be executed on evaluate, so on _any_ task'

    doLast {
        println 'after all tasks are evaluated this will only executed if mytask is executed'
    }

}
相关问题