You are reading documentation for 0.2.1. The latest release in the 0.2 line is 0.2.2.

The latest stable release is 0.8.4.

Buildish Mammoth Cache for Gradle and Maven

Documentation for Buildish Mammoth Cache for Gradle and Maven — CI actions that cache the build tool’s local artifact store across workflow runs.

Buildish Mammoth Cache for Gradle and Maven is a pair of CI actions that cache the build tool’s local artifact store across workflow runs:

  • Gradle — caches GRADLE_USER_HOME and provisions Gradle wrapper JARs securely before the build starts.
  • Maven — caches the Maven local repository (~/.m2 by default).

Both actions share the same two-phase prepare/finalize lifecycle and support single-job and distributed multi-job topologies.

For Gradle, Mammoth also preserves entries from Gradle’s local build cache, allowing Gradle to reuse task outputs. For Maven, Mammoth caches repository artifacts; build-output caching requires a separately configured extension.

Use Adoption and Migration to choose a topology, understand costs and plan a small pilot, then follow Getting Started for workflow wiring.

Single-job mode

In the most common setup, the action wraps a single build job: it restores the newest compatible immutable generation before the build and publishes a new complete generation after a material change. This avoids re-downloading dependencies on every run without creating duplicate entries for unchanged runs.

Distributed multi-job mode

When a workflow runs multiple build jobs in parallel — for example, one job per subproject or one job per test suite — independent full-cache generations diverge. Restoring only the newest generation then loses the dependency downloads that exist solely in the other workers’ generations.

This action solves that with a delta exchange model:

  • Each worker job computes only the difference between what was in the cache when it started and what is in the cache after the build. It uploads that delta as a workflow artifact.
  • A dedicated aggregator job, which runs after all workers complete, downloads every delta, merges them, and saves the merged result as the new base cache entry.

Aggregate partitions combine workers’ contributions subject to conflict policies; single-writer metadata partitions retain their designated writer’s view. See Adoption and Migration for the coverage tradeoffs.

graph LR
    BC["Base cache\n(previous run)"] --> W1 & W2 & W3
    W1["Worker A\nbuild + delta"] -- "Δ artifact A" --> AGG
    W2["Worker B\nbuild + delta"] -- "Δ artifact B" --> AGG
    W3["Worker C\nbuild + delta"] -- "Δ artifact C" --> AGG
    AGG["Aggregator\nmerge + save"] --> BC2["Base cache\n(this run)"]

Licensing and maintenance independence

Mammoth’s own code is Apache-2.0 licensed. The same license covers its cache orchestration in public and private repositories, including commercial builds. You can inspect and modify the implementation, maintain a fork, and redistribute it subject to the license conditions, including applicable license, notice and change-marking requirements. Using the caching implementation requires no separate Mammoth caching subscription.

Bundled dependencies retain their own licenses and attribution requirements; consult the distribution license inventory and notices for the version you use. GitHub cache/artifact services keep their own terms, limits and charges. Downloaded JDKs, Gradle/Maven distributions and separately used build services also retain their applicable terms.

When choosing a cache implementation, consider the rights to inspect, fix and maintain it, any separate provider agreements, and the effort required to migrate if its availability, terms or pricing change. Evaluate feature coverage and measured performance separately; an open-source license alone does not establish either.


User Guide

How to use Buildish Mammoth Cache for Gradle and Maven in your workflows.

Architecture & Background

Design documents covering the internal architecture of Buildish Mammoth Cache for Gradle and Maven.

Developer Guide

Architecture, portability, and release information for contributors to Buildish Mammoth Cache for Gradle and Maven.

Threat Model

Threat model for Buildish Mammoth Cache for Gradle and Maven.

Release Notes for 0.2.1

This release fixes distributed Gradle cache conflicts and misleading reports from expected child-build failures. It also enables complete artifact-transform workspace caching by default. The cache format changes: both Gradle and Maven start cold after upgrading, and cooperating jobs must upgrade together. Highlights Fix conflicts when independent workers generate the same Kotlin DSL workspace with different origin metadata. Preserve each recognized scripts/accessors workspace as one complete unit, including metadata, outputs and empty directories. Select one producer per workspace key while retaining disjoint keys from other workers. Legacy scripts and generated Gradle API JARs retain strict conflict handling. Fix conflicts between same-key Gradle build-cache archives whose origin metadata differs between builds. The built-in build-cache partition selects one producer’s whole, unchanged archive per key; it does not unpack or normalize archives. Enable transforms-metadata by default for recognized complete transform workspaces under caches/transforms-4/ and caches/<version>/transforms/. Retain metadata, outputs and empty directories together, including real output files named gc.properties. This can reuse outputs of transforms that do not participate in Gradle’s build cache. Unknown/incomplete layouts and workspaces containing mandatory-excluded outputs are skipped as whole units. Keep whole-workspace selection deterministic by producer job name, preserve strict overrides, and reuse unchanged partitions. Build membership indexes once per partition to avoid repeated scans for every workspace. Native base publication continues to avoid additional payload staging copies. Suppress build-result capture for child Gradle builds launched by Test tasks, including TestKit fixtures that deliberately fail. The enclosing build still reports unexpected test failures. Document the existing child-process opt-out for Exec and other process-launching tasks. Extend real independent-worker regression coverage for Kotlin workspaces and build-cache entries. Qualify transform workspace reuse locally on Linux with Gradle 8.7 and 9.8.1, cacheable/non-cacheable transforms, empty/no outputs and relocated readers, including a JDK 25 reader for Gradle 9.8.1. This is bounded coverage, not universal plugin or platform qualification. Upgrading from 0.2.0 Upgrade cooperating workers and aggregators together and start a new workflow run. Cache schema 8 and the new storage family intentionally start Gradle and Maven caches cold. Previous worker envelopes and local invocation state are incompatible; old backend entries expire normally without migration. Transform workspace caching is newly enabled. It adds metadata scans, payload hashing, archive storage and transfers, potentially alongside build-cache copies of the same outputs. Net performance depends on the build. To retain the previous disabled behavior, add this entry to the existing cache-partitions configuration: 1- id: transforms-metadata 2 enabled: false Captured transform outputs may contain private dependency content or sensitive data written by build logic, including transforms without @CacheableTransform. Ensure cache and worker-artifact readers may access those contents, or disable the partition. Workspace validation does not establish that outputs are secret-free. The built-in kotlin-dsl and transforms-metadata partitions default to conflict-handling: choose-worker-directory; build-cache defaults to the new choose-worker-entry policy. These select a whole producer view even if actual same-key outputs differ, assuming correctly declared, reproducible Gradle work. Set conflict-handling: default on the relevant partition to reject differing duplicates instead. Partial user selection of a complete workspace fails capture.