Manage unwanted task dependencies

I’ve seen a few variations of this question, but never really (imo) a great solution, so asking again in case anyone has thoughts.

I have a project named release that is part of the multi-project build. Really this task is meant to coordinate release-related operations. One of these operations is the creation of tgz and zip bundles using the distribution plugin. The distribution plugin apparently auto-wires itself to the standard assemble lifecycle task which normally makes perfect sense except in cases like this.

Often (CI, though even locally sometimes) we want to run build across the entire project. We are not doing a release here, so ideally all of the tasks associated with distribution should not get executed. But I am having a hard time finding a solution to this.

In visual form:

:release:build
+--- :release:assemble
|    +--- :release:distTar
|    |    +--- ...
|    \--- :release:distZip
|    |    +--- ...
\--- :release:check



Can’t you just do ./gradlew build -x :release:build?

That’s what I have been doing, yes.