Gradle "Build cache is disabled" - Enable Caching in CI
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.
What this error means
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. Tasks never report FROM-CACHE.
> Task :compileJava
Build cache is disabled
Calculating task graph as no cached configuration is available...
BUILD SUCCESSFUL in 6m 12s # full rebuild every runCommon causes
org.gradle.caching is not set
The build cache is off by default; without org.gradle.caching=true (or --build-cache) Gradle never stores or reuses outputs.
No persistent cache directory in CI
Even with caching on, an ephemeral runner with no cached ~/.gradle starts empty every time, so there is nothing to reuse.
No remote build cache configured
Local-only cache does not survive across runners; without a shared remote cache, parallel jobs cannot share outputs.
How to fix it
Enable the build cache
Turn on caching for every invocation via gradle.properties.
# gradle.properties
org.gradle.caching=truePersist the Gradle caches in CI
Cache the user home so local cache entries survive between runs.
# cache key on wrapper + build scripts
~/.gradle/caches
~/.gradle/wrapperConfigure a remote build cache
Share outputs across runners with a remote cache backend.
// settings.gradle
buildCache {
remote(HttpBuildCache) {
url = 'https://gradle-cache.example.com/cache/'
push = System.getenv('CI') != null
}
}How to prevent it
- Keep
org.gradle.caching=truecommitted ingradle.properties. - Persist
~/.gradle/cachesand~/.gradle/wrapperbetween CI runs. - Use a remote build cache so outputs are shared across runners and PRs.