I don’t understand why there is the task ‘buildNeeded’ which is provided by the java plugin.
Does not task ‘build’ solve the problem?
The gradle documentation says:
buildNeeded: Performs a full build of the project and all projects it depends on.
and
build: Performs a full build of the project.
Should / does not the task ‘build’ compile and build all the necessary things?
Why to distinguish between ‘build’ and ‘buildNeeded’?
buildNeededruns a fullbuildfor all projects that a project depends on. In particular it runstestfor the depended-on projects, which can make sense if you want to play it safe. By comparison,buildonly runs a minimum set of tasks for the depended-on projects (e.g.jar), just enough to satisfy the dependency.buildis used more often thanbuildNeeded.