What does Gradle 'build' task include exactly

Viewed 17523

I have searched on Gradle docs and on the stackoverflow and some other places but I can't find information about what is bundled in this task in depth, or I missed it, if so please point me to the direction.

  • It comes from java-base plugin, right?
  • Running gradle -q tasks doesn't say much about it.

build - Assembles and tests this project.

  • Running gradle help --task build shows detailed info, ok - but it show where the task is used, in which groups is included, type of a task, and paths.

  • I have tried to track manually what does comes with it, and noticed, compile, test etc tasks.

I would like to know what exactly comes from Gradle build task, what are the task dependencies.

4 Answers

In short:

Compiles, tests and assembles the code into a JAR file

More info here:

You’ll use the gradle build task frequently. This task compiles, tests, and assembles the code into a JAR file. You can run it like this:

gradle build

After a few seconds, "BUILD SUCCESSFUL" indicates that the build has completed.

To see the results of the build effort, take a look in the build folder. Therein you’ll find several directories, including these three notable folders:

  • classes. The project’s compiled .class files.
  • reports. Reports produced by the build (such as test reports).
  • libs. Assembled project libraries (usually JAR and/or WAR files).

Gradle Tasks view of Eclipse / Spring Tool Suite

enter image description here

Sample dry-run:

gradlew build --dry-run
gradlew -m build (Same as above)

:compileJava SKIPPED
:processResources SKIPPED
:classes SKIPPED
:bootWarMainClassName SKIPPED
:bootWar SKIPPED
:bootStartScripts SKIPPED
:bootDistTar SKIPPED
:bootDistZip SKIPPED
:jar SKIPPED
:startScripts SKIPPED
:distTar SKIPPED
:distZip SKIPPED
:war SKIPPED
:assemble SKIPPED
:compileTestJava SKIPPED
:processTestResources SKIPPED
:testClasses SKIPPED
:test SKIPPED
:check SKIPPED
:build SKIPPED

BUILD SUCCESSFUL in 32s

Related