Skip to content
Documentation

Docs / Adapter commands / Maven

Maven adapter

Keep Maven's build-cache extension and normal build phases. The adapter supplies the remote endpoint, write policy, and any missing default configuration.

Command
boringcache maven
Protocol
Maven build cache extension over /v1.1/* and /v1/*
Action
mode: maven

How the adapter works

Maven-native cache records

BoringCache does not guess Maven outputs. The build cache extension still decides what can be reused.

Shared trust boundaries

Use restore-only and save tokens instead of giving every job the same write access.

One place to inspect

Maven cache traffic lands in the same workspace reporting as the rest of the build.

Set up Maven

Keep the command and cache tag in .boringcache.toml, then use the same boringcache maven entrypoint locally and in CI. The adapter adds missing cache configuration without rewriting files already in your project.

[adapters.maven]
tag = "maven-cache"
command = ["mvn", "verify", "--batch-mode", "-ntp"]

# Run: boringcache maven

Before the first run

  • Prefer the project's Maven wrapper when it is present.
  • Keep any existing build-cache extension and cache configuration; the adapter preserves both.
  • Resolve unreadable or conflicting extension XML instead of asking the adapter to rewrite it.

Use the same adapter in GitHub Actions

The Action prepares the Maven extension and cache configuration, then gives the later Maven command the settings it needs.

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

- run: ./mvnw verify

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

Spring AI · Maven 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.