Skip to content
Documentation

Docs / Adapter commands / Gradle

Gradle adapter

Keep Gradle's task cacheability and cache keys. The adapter supplies the shared HTTP build-cache endpoint and write policy.

Command
boringcache gradle
Protocol
Gradle HTTP build cache over /cache/*
Action
mode: gradle

How the adapter works

Gradle-native cache

The build still uses Gradle's cacheable task model and HTTP build-cache protocol.

Same workspace as other tools

A JVM repo can share Gradle cache, Docker cache, and dependency archives under one repo cache plan.

Read-only PRs

Run pull requests restore-only, then publish cache from trusted branches.

Set up Gradle

Keep the command and cache tag in .boringcache.toml, then use the same boringcache gradle entrypoint locally and in CI.

[adapters.gradle]
tag = "gradle-cache"
command = ["./gradlew", "build", "--no-daemon"]

# Run: boringcache gradle

Before the first run

  • Prefer the project's Gradle wrapper.
  • Keep cacheable task inputs deterministic across the jobs expected to share outputs.
  • Review existing Gradle user-home and build-cache settings before adding overrides.

Use the same adapter in GitHub Actions

The Action prepares Gradle's HTTP build-cache configuration for the later wrapper command and keeps your existing project settings in place.

.github/workflows/ci.yml
- uses: boringcache/one@f0fb9b2d926a32b10c543e92093ba00c5a291b79 # v1.33.0
  with:
    trust-policy: auto
    mode: gradle

- run: ./gradlew build --no-daemon

Approve the repository through Connect CI and grant the job contents: read and id-token: write. The Action uses that Machine connection. Pull requests restore by default; trusted jobs may publish. See the authentication example in the GitHub Actions reference for scoped credentials when OIDC is unavailable.

GitHub Actions reference

Benchmarks

OpenTelemetry Java · Gradle remote build cache.

70–94%

Less cache to store

BoringCache stored 70–94% less cache data across public Go, Gradle, Maven, Nx, Turbo, and sccache comparisons.

Open run →

Tool reference

Check the tool's own reference when you need cache-key rules, build settings, or version-specific behavior.

All adapter commands

Compare every supported command, protocol, and Action mode in one place.

Adapter command index →

Need help or found something unclear? Open an issue or browse the CLI repo.