I have a multi-project setup and would like to find a way how to invoke ‘clean’ and ‘cleanEclipse’ for all projects, even if I am in a child project (not in root).
If I invoke “gradle clean” in root-project: Works
If I invoke “gradle :clean” in sub-project:
Task ‘clean’ not found in root project ‘server’.
If what you want to do is to create a clean task on the root project that triggers clean for all subprojects, and that not all subprojects define a clean task, you can still create it in the root project:
That’s because there a small typo
it’s
rootProject.clean.dependsOn tasks.matching { it.name == “clean” }
or
rootProject.clean{ dependsOn tasks.matching { it.name == “clean” } }