Use case for buildNeeded task?

I do not understand why there is a buildNeeded task that is provided by the java plugin. Does the problem "build" the problem? The gradle documentation says:

buildNeeded: Performs a complete assembly of the project and all its projects.

and

build: Performs a complete build of the project.

Should / shouldn't compile the task compilation and build all the necessary things? Why distinguish between "build" and "buildNeeded"?

+7
source share
2 answers

buildNeeded runs a full build for all the projects on which the project depends. In particular, it runs test for dependent projects, which may make sense if you want to play safely. For comparison, build performs only a minimal set of tasks for projects with a dependency on it (for example, jar ), enough to satisfy the dependency. build used more often than buildNeeded .

+7
source

build does not invoke a complete build for all child projects.

If the project does not have dependent projects, it does not matter.

The idea is that if you change the API in the parent project, you want to recompile all the child projects with a new one.

+1
source

All Articles