project.task("myTask1") task("myTask2") task "myTask3" task myTask4 myTask4.description = "This is what's shown in the task list" myTask4.group = "This is the heading for this task in the task list." myTask4.doLast {println "Do this last"} myTask4.doFirst {println "Do this first"} myTask4.leftShift {println "Do this even more last"} myTask4 << {println "Do this last of all"} task myTask5 { description "Here's a task with a configuration block" group "Some group" doLast { println "Here's the action" } } task myTask7 { description("Description") group = "Some group" } task myTask8(description: "Another description") << { println "Doing something" }
depend on
task putOnSocks { doLast { println "Putting on Socks." } } task putOnShoes { dependsOn "putOnSocks" doLast { println "Putting on Shoes." } }
[vagrant@localhost ud867]$ gradle -q putOnShoes Putting on Socks. Putting on Shoes.
task copyImage(type: Copy) { from 'images' into 'build' } task copyJpegs(type: Copy){ from 'images' include '*.jpg' into 'build' } task copyImageFolders(type: Copy){ from('images'){ include '*.jpg' into 'jpeg' } from('images'){ include '*.gif' into 'gif' } into 'build' } task zipImages(type: Zip){ baseName = 'images' destinationDir = file('build') from 'images' }