Gradle ignores TaskOutputs when building


I have a simple task that that defines inputs/outputs. I expect gradle to run the task when any outputs do not exist. Is this a correct assumption? In reality gradle is skipping the task because it thinks it is up-to-date, even when the defined outputs do not exist:

task createFiles( type:GradleBuild) { GradleBuild gb ->
    // calls out to ant to create some files
    gb.buildFile = 'ant.gradle'
    gb.tasks = ['build']
    inputs.dir 'src/'
    outputs.file 'build.ant/dist/my_file_1'
    outputs.file 'build.ant/dist/my_file_2'

Without much difficulty, I can delete ‘build.ant/’ and gradle still will not rerun the ‘createFiles’ task. Any reason why this would happen?


Ok, I had a typo in my outputs.file names … so I guess when task executes and gradle can’t find the outputs, it puts them on an ignore list.

I really wish there was a way to get gradle to abort if the defined outputs do not exist after the task finishes.