It looks like you can just do the following:
task foo(dependsOn: ['clean', 'jar']){ foo << { println "First" } foo << { println "Second" } foo << { println "Third" } . . . }
where << is short for doLast . I think this is very important, since only foo shown. Nested tasks remain hidden from the end user. And if you execute foo , you will get
First Second Third
source share