# Gradle "Build cache is disabled" - Enable Caching in CI

> Fix Gradle "Build cache is disabled" in CI - the cache flag is off, so every task re-runs from scratch and builds are slow; enable the local/remote build cache for fast incremental CI.

Source: https://latchkey.dev/learn/java-jvm/gradle-build-cache-is-disabled-warning-in-ci  
Updated: 2026-06-26

Gradle reported that its build cache is disabled, so it cannot reuse task outputs from a previous run. Nothing breaks, but every CI build does the full work - compilation, tests, packaging - even when nothing changed.

## Diagnose it: get the real failure out of Gradle

Gradle summarises failures aggressively, and the top-level message frequently describes a downstream symptom rather than the cause. Re-run the failing task with diagnostics before changing build logic.

```Terminal
# the actual stack, plus what Gradle decided about the build
./gradlew <task> --stacktrace --info

# is a stale daemon or cache involved?
./gradlew --stop
./gradlew <task> --no-daemon --no-build-cache

# what does Gradle think the environment is?
./gradlew -version
```

> A JVM or Gradle version mismatch between your machine and the runner explains a large share of CI-only Gradle failures. Pin the JDK with `setup-java` and pin Gradle with the wrapper, then confirm both with `./gradlew -version` in CI.

## Configuration cache and CI

- The configuration cache rejects build logic that reads mutable state at execution time, which is why enabling it surfaces errors an existing build never showed.
- Run with `--configuration-cache-problems=warn` first to see the full list rather than failing on the first one.
- A cached configuration keyed to a different environment is worse than none. Include the JDK version in your cache key.

## FAQ

### What causes Gradle "Build cache is disabled"?

There are 3 common causes: org.gradle.caching is not set, no persistent cache directory in ci, and no remote build cache configured. The build cache is off by default; without org.gradle.caching=true (or --build-cache) Gradle never stores or reuses outputs.

### How do I fix Gradle "Build cache is disabled"?

There are 3 fixes depending on which cause you have: enable the build cache, persist the gradle caches in ci, and configure a remote build cache. Work through them in order, since the first is the most common.

### What does Gradle "Build cache is disabled" actually mean?

A --scan or info-level log shows Build cache is disabled, and CI builds take the same long time regardless of how small the change is.

### How do I stop Gradle "Build cache is disabled" happening again?

Keep org.gradle.caching=true committed in gradle.properties. The prevention section lists 3 changes that keep it from recurring.

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
