I have the following defined for configuring the ‘clean’ task:
clean {
ext.deployDir = 'foo/bar'
ext.inputFiles = fileTree(dir: deployDir, include: 'rest-example-*.war')
inputs.files inputFiles
doLast {
delete inputFiles
}
}
My task runs every time when I execute “gradle clean” and in the debug output I see
14:34:58.908 [INFO] [org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter] Executing task ‘:rest-example:clean’ (up-to-date check took 0.0 secs) due to:
Task has not declared any outputs. 14:34:58.908 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter] Executing actions for task ‘:rest-example:clean’.
So, the 2 issues I see are 1.) it never executes the delete since the wars are still there and 2.) how do you specify outputs for a case like this.
BTW, I didn’t use “outputs.dir deployDir” in the clean task becasue other tasks will be adding and cleaning their content from the deplyDir.