Gradle - Build

About

A build is a lifecyle task that executes a graph of task

Execution

Gradle executes build scripts in three fixed phases:

  • Initialization: Sets up the environment for the build and determine which projects will take part in it.
  • Configuration: Constructs and configures the task graph for the build and then determines which tasks need to run and in which order, based on the task the user wants to run.
  • Execution: Runs the tasks selected at the end of the configuration phase.

These phases form Gradle’s Build Lifecycle.

Management

Execute

gradle build

Incremental

Tasks should define inputs and outputs to get the performance benefits of an incremental build.

https://docs.gradle.org/current/userguide/more_about_tasks.html#sec:up_to_date_checks

Gradle comes with a sophisticated incremental Java compiler that is active by default (ie cache is on) doc

Set Build File

Specify the build file.

gradle [-b|--build-file]

Set Property

Set project property for the build script (e.g. -Pmyprop=myvalue).

gradle -P, --project-prop       

Disable Cache

  • Disables the Gradle build cache.
gradle --no-build-cache          
  • Disable Task cache
gradlew build --rerun-tasks         

Include

see Gradle - Build composite

Dry run

Run the builds with all task actions disabled.

gradle [-m|--dry-run]

Output





Discover More
Card Puncher Data Processing
Gradle

gradle is a build tool that can run: a build (a set of tasks) or a single task gradle/gradle/
Gradle - Build Scan

A build scan is a rich, web-based view of a build You create a build scan at scans.gradle.com (free of charge) with the following info...
Gradle - Cache (.gradle)

Defaults to .gradle in the root project directory. Specify the project-specific cache directory. Ignore previously cached task results. Disables the Gradle build cache. Enables the Gradle...
Gradle - Configuration (Phase and element)

The configuration phase is the second fixed phase of a build execution It constructs and configures the task graph for the build and then determines which tasks need to run and in which order, based on...
Gradle - Graph of Task (Dag)

A build execute a graph (dag) of task. This dag is build itself in the second phase of the build execution.
Gradle - Single Project

A single-project has only the root project listed in the output of the gradle projects command, it's a multi-project ...
Gradle - Task

A build process execute a graph of tasks. Task may just be: container (lifecycle task) or provided by plugin In execution with the wrapper of the project Tasks themselves consist of:...



Share this page:
Follow us:
Task Runner