The magic of the 'build' task

I’ve search around, but I still fail to understand the magic of the “build” task.

The best I could find was this, explaining that the build task is created by the java-base plugin and therefore may not exist in the root project. Obviously, when invoked with a task name that does not exist in the root project, gradle searches the subprojects for tasks with the name and executes those. BUT…

I have now listed all tasks in my subprojects programmatically

subprojects.tasks.flatten().findAll { task -> println }

and I cannot find a single “build” task in the output. I get all the java related tasks such as “compileJava”, “jar” etc. but NO “build”. (Not surprisingly, the documentation of the Java plugin does not include a “build” task either.)

Could somebody please clarify how gradle build works? Obviously not as all the other gradle <some task> examples that I find all over the documentation.


(As you may guess, my ultimate goal is to depend a new task on a “build” of my java subprojects, that’s why I need to find this task.)