Task dependsOn syntax

I have spent some time on the issue during migration from gradle 7.6 to 8.5
In my old groovy script, I had like:
task taskA(type: TaskTypeA, dependsOn: ['taskB'])

and after the gradle update “dependsOn” stopped working but did not write an error or warning.
It was not so easy to find out what is the problem, because there are many answers with dependsOn['teskname']
on stackowerflow.

So my question is where is described that dependsOn syntax was changed? I was looking at migrations docs and did`n find it there. (Upgrading your build from Gradle 7.x to 8.0)

dependsOn[‘taskname’] - doesn`t work
dependsOn ‘taskname’ - works
dependsOn(‘taskname’) - works


I don’t think anything changed in that regard, unless you also changed from Groovy DSL to Kotiln DSL.
Especially, if you did not get any deprecation warnings in 7.6.x, the build should usually work unchanged in Gradle 8, except maybe for added deprecation warnings.

Thank you so much. Now I understand the issue.
My mistake was next: during the update gradle I also replaced
task A(dependsOn: ['B']) { ... }
tasks.register('A') { dependsOn['B'] ... }

1 Like

Yeah, that is of course invalid syntax there. :slight_smile: