You are reading documentation for 0.8.1. The latest release in the 0.8 line 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.8.1

This patch reduces Mammoth’s own work in the main and post steps: it makes fewer filesystem calls, stages and indexes worker merges with less overhead, and an aggregator downloads worker artifacts concurrently. Cache formats are unchanged. Highlights Download worker artifacts concurrently in the aggregator, up to four at a time, and merge them in selection order. After the first failed download no further download starts. Do less of Mammoth’s own filesystem work. The native walk observes each file once and lists and stats synchronously. Paths that the invocation created in its own staging are no longer re-checked against concurrent changes, following the new filesystem trust zones in the threat model. Worker merges stage files with synchronous calls, worker acceptance indexes the staging from what it recorded instead of walking it again, and disposable trees are retired with synchronous calls. Plan an aggregator’s worker install from the tree the base install just left instead of walking the whole cache root again. Directories restored intact from a trusted base are walked only when a worker writes into them. Install a single-writer snapshot entry by entry when its partition root is present with the same mode. New, changed and stale entries are placed or deleted, and files with the same size, mode and mtime millisecond are kept, so an unchanged dependency-metadata tree is no longer backed up and replaced in every job. Worker snapshots are adopted from the installed staging by rename instead of being copied. Use less CPU and memory for path validation, record encoding, TAR header parsing, partition owner lookup and install scratch reads. Add filesystem trust zones and fail-safe interruption to the threat model. Upgrade notes No action-input or workflow changes are required. Cache formats are unchanged, and existing 0.8.0 cache generations can be reused. Like aggregate partitions, a single-writer snapshot file that is rewritten with the same size and mode within the same millisecond is now kept as unchanged. A native directory listing is read whole before the directory breadth limit is checked, so an oversized local directory briefly holds about 150 bytes per entry before it is rejected. Restored archives stay bounded while they are extracted. Review v0.8.1-rc1 as the first release candidate and use v0.8.1 after final promotion.