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

Dry run

Run the builds with all task actions disabled.

gradle [-m|--dry-run]

Output


Powered by ComboStrap