Configuration Cache
The Configuration Cache improves build performance by caching the result of the configuration phase and reusing it for subsequent builds.

Configuration Cache Basics
The Gradle Build Lifecycle consists of three phases: initialization, configuration, and execution.
-
The initialization phase determines the structure of the build.
-
The configuration phase evaluates what work needs to be done.
-
The execution phase performs that work.
Gradle’s Build Cache has long optimized the execution phase by reusing previously built outputs and parallelizing as much work as possible.
The Configuration Cache builds on this idea of work avoidance and parallelization. When enabled, the Configuration Cache allows Gradle to skip the configuration phase entirely if nothing that affects the build configuration (such as build scripts) has changed. Additionally, Gradle applies performance optimizations to task execution.
To do this, Gradle does the following:
Phase | Cache | Work Avoidance | Parallelism and Performance |
---|---|---|---|
Execution |
Build Cache |
Uses task inputs and outputs |
Runs independent tasks in parallel with |
Configuration |
Configuration Cache |
Uses build logic and environment |
Runs tasks in parallel (within the same project), optimizes memory, and more |
The Configuration Cache is similar to the Build Cache, but they store different types of data:
-
Build Cache: Stores outputs and intermediate files of the build (e.g., task outputs, artifact transform outputs).
-
Configuration Cache: Stores the build configuration for a particular set of tasks, capturing the output of the configuration phase.

This feature is not enabled by default and has the following limitations:
Since Gradle 9.0 the Configuration Cache is the preferred mode of execution. |
Work Avoidance
When the Configuration Cache is enabled and you run Gradle for a specific set of tasks, such as ./gradlew check
, Gradle looks for a Configuration Cache entry.
If a matching entry is found, Gradle reuses it and skips the configuration phase entirely.
A cache hit is essential for avoiding configuration work.
Configuration Cache Entries
A cache entry contains:
-
The set of tasks to run
-
Their configuration details
-
Dependency information
First-Time Execution

The first time you run a set of tasks, there is no cache entry. Gradle performs the configuration phase as usual:
-
Run init scripts.
-
Run the settings script, applying any requested settings plugins.
-
Configure and build the
buildSrc
project, if present. -
Run build scripts, applying any requested project plugins. If plugins come from included builds, Gradle builds them first.
-
Calculate the task graph, executing deferred configuration actions.
Gradle then stores a snapshot of the task graph in the Configuration Cache for future use. After this, Gradle loads the task graph from the cache and proceeds with task execution.
Subsequent Runs

On subsequent executions of the same tasks (e.g., ./gradlew check
again), Gradle:
-
Skips the configuration phase entirely.
-
Loads the task graph from the Configuration Cache instead.
Before using the cache, Gradle verifies that no build configuration inputs have changed. If any input has changed, Gradle reruns the configuration phase and updates the cache.
Build Configuration Inputs
The following elements determine whether a Configuration Cache entry is valid:
-
Gradle environment
-
GRADLE_USER_HOME
-
Gradle Daemon JVM
-
-
Init scripts
-
buildSrc
and included build logic build contents (build scripts, sources, and intermediate build outputs) -
Build and Settings scripts, including included scripts (
apply from: foo.gradle
) -
Gradle configuration files (Version Catalogs, dependency verification files, dependency lock files,
gradle.properties
files) -
Contents of files read at configuration time
-
File system state checked at configuration time (file presence, directory contents, etc.)
-
Custom
ValueSource
values obtained at configuration time (this also includes built-in providers, likeproviders.exec
andproviders.fileContents
). -
System properties used during the configuration phase
-
Environment variables used during the configuration phase
Serialization
Gradle uses an optimized serialization mechanism to store Configuration Cache entries. It automatically serializes object graphs containing simple state or supported types.
While Configuration Cache serialization doesn’t rely on Java Serialization, it understands some of its features. This can be used to customize serialization behavior, but incurs performance penalty and should be avoided.
Performance Improvements
Beyond skipping the configuration phase, the Configuration Cache enhances performance in the following ways:
-
Parallel Task Execution: All tasks run in parallel by default, subject to dependency constraints.
-
Cached Dependency Resolution: Dependency resolution results are stored and reused.
-
Optimized Memory Usage: After writing the task graph to the cache, Gradle discards configuration and dependency resolution state from memory, lowering peak heap usage.

IDE Support
If you enable and configure the Configuration Cache in your gradle.properties
file, it will be automatically enabled when your IDE delegates builds to Gradle.
No additional setup is required.
Because gradle.properties
is typically checked into source control, enabling the Configuration Cache this way will apply to your entire team.
If you prefer to enable it only for your local environment, you can configure it directly in your IDE instead.
Syncing a project in an IDE does not benefit from the Configuration Cache. Only running tasks through the IDE will leverage the cache. |
IntelliJ based IDEs
In IntelliJ IDEA or Android Studio this can be done in two ways, either globally or per run configuration.
To enable it for the whole build, go to Run > Edit configurations…
.
This will open the IntelliJ IDEA or Android Studio dialog to configure Run/Debug configurations.
Select Templates > Gradle
and add the necessary system properties to the VM options
field.
For example to enable the Configuration Cache, turning problems into warnings, add the following:
-Dorg.gradle.configuration-cache=true -Dorg.gradle.configuration-cache.problems=warn
You can also choose to only enable it for a given run configuration.
In this case, leave the Templates > Gradle
configuration untouched and edit each run configuration as you see fit.
Using these methods together, you can enable the Configuration Cache globally while disabling it for certain run configurations, or vice versa.
You can use the gradle-idea-ext-plugin to configure IntelliJ run configurations from your build. This is a good way to enable the Configuration Cache only for the IDE. |
Eclipse based IDEs
In Eclipse-based IDEs, you can enable the Configuration Cache through Buildship, either globally or per run configuration.
To enable it globally:
-
Go to
Preferences > Gradle
. -
Add the following JVM arguments:
-
-Dorg.gradle.configuration-cache=true
-
-Dorg.gradle.configuration-cache.problems=warn
-
To enable it for a specific run configuration:
-
Open
Run Configurations….
-
Select the desired configuration.
-
Navigate to
Project Settings
, checkOverride project settings
, and add the same system properties asJVM arguments
.
Using these methods together, you can enable the Configuration Cache globally while disabling it for certain run configurations, or vice versa.