Java 梯度任务列表
为什么下面的代码不向生成组添加任务:Java 梯度任务列表,java,groovy,gradle,Java,Groovy,Gradle,为什么下面的代码不向生成组添加任务: apply plugin: 'java' task hello << { description = 'To say hello to a task list' group = 'build' } 但以下情况确实如此: apply plugin: 'java' task hello { description = 'To say hello to a task list' group = 'build' } g
apply plugin: 'java'
task hello << {
description = 'To say hello to a task list'
group = 'build'
}
但以下情况确实如此:
apply plugin: 'java'
task hello {
description = 'To say hello to a task list'
group = 'build'
}
gradle任务命令的输出:
Build tasks
-----------
assemble - Assembles the outputs of this project.
build - Assembles and tests this project.
buildDependents - Assembles and tests this project and all projects that depend
on it.
buildNeeded - Assembles and tests this project and all projects it depends on.
classes - Assembles classes 'main'.
clean - Deletes the build directory.
hello - To say hello to a task list
jar - Assembles a jar archive containing the main classes.
testClasses - Assembles classes 'test'.
由于您将任务配置与任务操作混合在一起,有关详细信息,请参阅 在这段代码中:
apply plugin: 'java'
task hello << {
description = 'To say hello to a task list'
group = 'build'
}
因为第一个变体是以下的缩写:
task hello
hello.doLast {
description = 'To say hello to a task list'
group = 'build'
}
apply plugin: 'java'
task hello {
description = 'To say hello to a task list'
group = 'build'
}
task hello
hello.doLast {
description = 'To say hello to a task list'
group = 'build'
}