Gradle always "No history is available for task 'X'


(Björn Kautler) #1

I have a task without outputs. But I cannot get it not to execute. If I define no outputs of course it says “No outputs” and executes. If I define either “outputs.file ‘build/generate.dummy’” with the file being present or “outputs.upToDateWhen { true }”, Gradle states “No history is available for task ‘X’.”, no matter how often I execute the task. Am I doing something wrong?


(Peter Niederwieser) #2

Sounds like you are deleting the ‘.gradle’ directory between builds, or are executing each build in a new workspace (e.g. on a CI server). Can you provide a reproducible example?


(Björn Kautler) #3

I’m not aware of deleting the .gradle directory and I’m not on a CI server. Just in my private workspace, doing the executions directly one after another without deleting anything in-between.


(Peter Niederwieser) #4

Works fine for me. Please provide a reproducible example.


(Björn Kautler) #5

Ah, forget it, that was my error. The task caused the build to fail. And in this situation there is of course no history record made. If I make the task not to fail the build, upToDateWhen works fine.

But now I have another problem. The task has no outputs, but depends on some inputs. So it should be executed if the inputs change. My task has “dependsOn: [sharedJar, sharedServerJar, serverJar, guiJar]” where those tasks are tasks of type “Jar”. Shouldn’t my task execute if one of those tasks is executed and thus their output changed, or do I have to declare the inputs explicitly?


(Peter Niederwieser) #6

You have to declare all inputs of your task. Which other tasks it depends on has no influence on this.


(Björn Kautler) #7

Oh, ok, thanks. I thought a task should be considered OUT-OF-DATE if a task it depends on gets reexecuted. But maybe it is better this way. I just thought Gradle does it that way.