Steve Ramage
12/22/2022, 8:07 PMclasses.dependsOn += otherTask
But I'm struggling to figure out what the new version of that should be.
tasks.named("classes").dependsOn.add(tasks.named("otherTask"))
Complains with "Unresolved reference "depends on"Josh Eldridge
12/22/2022, 8:11 PMSteve Ramage
12/22/2022, 8:13 PMtasks.named("classes") {
dependsOn("otherTask")
}
Josh Eldridge
12/22/2022, 8:13 PMSteve Ramage
12/22/2022, 8:14 PMSteve Ramage
12/22/2022, 8:14 PMVampire
12/22/2022, 10:09 PMdependsOn
explicitly, you are doing something wrong, except the left-hand side is a lifecycle task. You should usually instead properly wire inputs and outputs together so that you get implicit task dependencies where you need them automatically.
And in Kotlin DSL you have type-safe accessors for plugins applied using the plugins { ... }
DSL, so if you properly apply the plugin using that DSL, you can also just use tasks.classes { ... }
instead of tasks.named("classes") { ... }
. 🙂Steve Ramage
12/22/2022, 10:40 PMVampire
12/22/2022, 10:41 PMclasses.dependsOn otherTask
in Groovy DSL 🙂Vampire
12/22/2022, 10:42 PMSteve Ramage
12/22/2022, 10:42 PMVampire
12/22/2022, 10:46 PMSteve Ramage
12/22/2022, 11:51 PMmelix
12/23/2022, 8:29 AMdependsOn
being wrong: https://melix.github.io/blog/2021/10/gradle-quickie-dependson.html
With classes
being a lifecycle task, you are almost certainly doing it wrong. What you want to describe is not "when I reach the classes
state, then all classes should be compiled", but rather "this task needs the output classes of this other task on its compile classpath".Amanda Martin
12/23/2022, 2:58 PM