4.times{ number ->
task "task$number" << {
println("task$number");
}
}
task2.dependsOn task1, task0, task3
上面设置任务
task2
的代码取决于此处定义的任何其他任务。但是groovy语法中的task2.dependsOn
是什么?它看起来不像方法调用。
最佳答案
这是采用3个参数的方法调用
http://groovy.codehaus.org/Statements
Optional parenthesis
Method calls in Groovy can omit the parenthesis if there is at least one parameter and there is no ambiguity.
println "Hello world" System.out.println "Nice cheese Gromit!"
关于groovy - Gradle动态依赖,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26093149/