this official doc描述了如何在gradle中定义任务,例如:
task helloTask {
println 'Hello World!'
}
看来这段代码实际上意味着一个方法调用,即Task task(String name, Closure configureClosure)
。
由于这是一个方法调用,因此helloTask
应该是name
类型的参数String
。那么‘’
或""
在哪里?
ps。
顺便说一句,括号与标准的常规方法调用看起来有所不同。
答案 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'
}
}