Gradle Task

fiinalizeBy

taskX.finalizedBy taskY

up-to-date

onlyIf

task hello << {
    println 'hello world'
}

hello.onlyIf { !project.hasProperty('skipHello') }

dependsOn

taskA.dependsOn(taskB)

from / into / description / include

description 描述

task copy(type: Copy) {
   description 'Copies the resource directory to the target directory.'
   from 'resources'
   into 'target'
   include('**/*.txt', '**/*.xml', '**/*.properties')
}

mustRunAfter

taskB.mustRunAfter(taskA) //只有A B都需要执行时,这才生效,单独执行B,不会启动A

overwrite

task copy(type: Copy) {
    println('I am the old one.')
}

task copy(overwrite: true) {
    println('I am the new one.')
}