Delete task in execution phase

Hi, I would like to ask you for help. I somehow don’t understand, how to leverage Gradle’s Delete task in execution phase. task T1(dependsOn: T2) << { // some behaviour } task T2(type: Delete) << { delete 'myTestFile.txt' // since this is in execution phase, it won't work as expected …