Gradle Cache Internals
Understanding which parts of the Gradle user home (~/.gradle) are safe to cache across CI runners
and which parts cause corruption or non-determinism is the foundation of this action’s partition design.
Gradle user home structure
| Directory | Purpose | Cache for CI? |
|---|---|---|
caches/ |
Central repository for all cached resources | Yes, selectively |
daemon/ |
Registry and logs for long-running Gradle daemon processes | No |
wrapper/ |
Downloaded Gradle distributions and metadata | Yes |
native/ |
Platform-specific native libraries (regenerated on demand) | No |
jdks/ |
JDKs downloaded by Java toolchain auto-provisioning | No |
notifications/ |
Per-version marker that the welcome message was shown | No |
Dependency store: caches/modules-2/
files-2.1/ — Storage for downloaded artifacts and descriptor files, such as JARs and POMs.
The path encodes the artifact coordinates and the SHA-1 checksum of the file’s content (leading
zeros stripped):
caches/modules-2/files-2.1/<group>/<module>/<version>/<sha1>/<filename>
Gradle only adds files to this store and never modifies them. The path contains no machine-specific
parts, so files-2.1/ is portable across machines.
metadata-*/ — Gradle’s binary dependency-resolution cache. It records resolved module
descriptors and dependencies, dynamic-version results, artifact-file references, missing modules
or artifacts, repository identity, and cache timestamps used for expiry. Downloaded POM and Ivy
files are stored separately in files-2.1/.
resources-2.1/ — Files that Gradle fetched by URL outside module resolution’s artifact store,
such as maven-metadata.xml listings for dynamic and snapshot versions. The layout is
<url-hash % 100>/<sha1>/<filename>, and the resource-at-url.bin index in metadata-*/ maps
URLs to these files. Gradle only adds files here. When an index entry points to a missing file,
Gradle discards the entry and fetches the resource again. The writable module-support partition
captures this store.
Dependency caches populated by Gradle 6.1 or later are relocatable, including metadata; see the
Gradle 6.1 release notes.
Gradle documents relative paths for both stores. Preserve the caches/modules-<version>/ structure,
use compatible cache formats, and omit *.lock and gc.properties when copying; see
Copying and reusing the cache.
Mammoth caches artifact files in dependency-artifacts and resolution metadata in the separate,
enabled-by-default dependency-metadata partition. In standalone mode, the current job owns
metadata publication. Distributed mode accepts one complete snapshot from the partition’s
configured writer; other jobs’ local updates are omitted. If the writer contributes no snapshot,
Mammoth carries forward the previous snapshot. With no writer configured, or with the aggregator
itself named, the aggregator publishes its own complete metadata snapshot. Ordinary workers
export metadata only when explicitly named as writer.
A snapshot replaces the entire configured metadata file set, including removals. An explicit empty
snapshot clears it; an absent contribution preserves it. Before restore, Mammoth removes preexisting
managed metadata and reports that replacement in a warning and summary. A miss starts the managed
metadata partition empty, even on a self-hosted runner and with cleanup-enabled: false.
User-excluded files remain unmanaged. Explicitly narrowing the definition is supported; the user
is responsible for any effect on Gradle’s ability to use the remaining metadata.
Snapshots use excluded local staging and fixed archive transport paths. Capturing a standalone snapshot also copies and hashes the complete configured partition; a distributed writer additionally uploads it in its worker envelope. Mammoth does not merge binary indexes or apply per-file timestamp GC to these snapshots. Gradle can clean its local copy, and its writer’s next snapshot reflects that. Ordinary artifact GC continues independently, so retained metadata does not guarantee offline completeness. Different Gradle cache formats can coexist; Gradle’s cache version table lists which Gradle versions share a metadata format.
See Distributed multi-job builds for writer configuration and skipped-writer examples.
Artifact transforms
Artifact transforms adapt
resolved dependencies before tasks consume them, for example by unpacking a JAR or rewriting its
bytecode. Gradle stores their derived outputs in transform workspaces. Their location varies by
Gradle version; layouts include caches/transforms-*/ and caches/<version>/transforms/.
Transform outputs are not inherently non-portable. Gradle supports caching reproducible, relocatable
transforms through
@CacheableTransform.
Reuse depends on the transform’s implementation and correctly declared inputs and normalization.
The enabled transforms-metadata partition captures complete immutable workspaces
under caches/transforms-4/<32-hex-key>/ and
caches/<version>/transforms/<32-hex-key>/. The shared transforms-4 store was used by
Gradle 8.6 and 8.7;
Gradle 8.8’s user-home services
switch to the version-scoped store. Older transforms-1, -2 and -3 layouts,
unknown roots and temporary workspace suffixes are skipped with bounded warnings.
This is a structural support contract, not universal Gradle/plugin compatibility.
Mutable project-local transform workspaces are outside this user-home partition.
Each supported workspace retains nonempty metadata.bin, regular results.bin,
transformed/, every additional output file and empty output directories. A transform
registering no outputs can have an empty results.bin; this is valid. Mammoth never
strips origin metadata or rewrites Gradle metadata to make independent producers agree.
It selects one complete producer per key using choose-worker-directory, preserving
disjoint keys. Strict conflict handling remains available. Usage and GC operate on
whole units, as for the DSL workspace partitions.
Transform output filenames are not cleanup markers: a nested gc.properties is
preserved through worker artifacts and native base archives. A workspace containing
mandatory-excluded output (such as .lock files or reserved Mammoth metadata
descendants) is skipped as a whole. User includes/excludes that select only
part of an otherwise complete workspace fail capture. Known bookkeeping outside
workspace roots is excluded; unknown/incomplete units never fall back to file capture.
Cacheable transforms can also store outputs in Gradle’s build cache, which the
build-cache partition transports independently. Direct workspace transport can
add reuse for transforms without @CacheableTransform. This does not imply that
all such outputs are appropriate to share: private dependencies or sensitive values
written into outputs are visible to the cache and worker-artifact readers. Transform
workspaces do not serialize the configuration cache’s configured task graph. See
the threat model for the confidentiality boundary.
Maintained local qualification covers Linux, JDK 21, Gradle 8.7 and 9.8.1, independent producers and relocated fresh readers, using a real JAR-expansion transform with cacheable/non-cacheable, empty-directory and no-output variants. The 9.8.1 reader also exercises JDK 25 when available. A build-cache-disabled reader proves direct workspace reuse. The fixture is controlled build logic, not third-party plugin or all-OS qualification; no general performance claim follows from it.
Capturing workspaces adds metadata scans, hashing of changed partitions, archive
bytes and transfer I/O, potentially alongside build-cache copies of the same outputs.
Measure the tradeoff for the build. Disable this partition with enabled: false if
those costs outweigh reuse. The cache schema 8 transition cold-starts previous Gradle
and Maven families, including old opt-in/custom transform captures; there is no migration.
Build cache: caches/build-cache-1/
The Gradle build cache stores task output snapshots keyed by a hash of task inputs. How file
inputs contribute to that key depends on their
PathSensitivity.
Only ABSOLUTE prevents sharing entries between different workspaces.
| Sensitivity level | Key dependency | Portable? |
|---|---|---|
ABSOLUTE |
Full local file path | No |
RELATIVE |
Path relative to the root of its file collection | Yes |
NAME_ONLY |
File and directory names only | Yes |
NONE |
File content only | Yes |
caches/build-cache-1/ is a good candidate for caching provided build authors have configured
task inputs to be path-agnostic.
Independent builds can write different origin metadata into archives with the
same key. Mammoth’s built-in build-cache partition therefore selects one
producer’s whole, unchanged archive per direct 32-hex key. The smallest producer
job name wins; distinct keys remain additive. This also resolves differing output
bytes under the same key, assuming correctly declared, reproducible work. Mammoth
does not unpack or normalize these archives. Set conflict-handling: default to
reject differing duplicates instead.
Version-specific caches: caches/<version>/
For each Gradle version used, a dedicated directory records the operational state of that build tool
version. Mammoth captures the recognized workspace stores below it (transforms/, kotlin-dsl/,
groovy-dsl/, dependencies-accessors/, zinc-*/). Other subtrees hold local indexes that Gradle rebuilds on demand and are not
captured by the built-in partitions. Directory names use Gradle’s camelCase spelling; they are
the same in Gradle 8.14 and 9.x.
| Path | Contents |
|---|---|
caches/<version>/fileHashes/ |
File hash indexes and their lock |
caches/<version>/file-changes/ |
last-build.bin marker used to judge timestamp accuracy |
caches/<version>/javaCompile/ |
Java class and JAR analysis databases and their lock |
caches/<version>/fileContent/ |
Annotation processor detection results and their lock |
caches/<version>/md-rule/ |
Results of cacheable component metadata rules |
caches/<version>/md-supplier/ |
Results of component metadata supplier rules, with expiry |
caches/<version>/expanded/ |
Only a lock that coordinates archive extraction |
caches/<version>/jvms/ |
Detected JVM metadata |
caches/<version>/workerMain/ |
gradle-worker.jar for worker processes |
caches/<version>/generated-gradle-jars/ |
Generated Gradle API and TestKit JARs |
caches/<version>/dependencies-accessors/ |
Compiled version-catalog accessors (complete workspaces) |
caches/<version>/zinc-<z>_<s>_<j>/ |
Compiled Scala compiler bridge |
caches/<version>/cc-keystore/ |
Configuration-cache key material (always excluded) |
The .bin files in these directories are Gradle indexed caches: single-file B-tree databases that
Gradle updates in place. md-rule/ and md-supplier/ are such databases too, so they share the
merge problem described for javaCompile/ below. expanded/ holds no data: extracted archive
contents go to project-local temporary directories.
fileHashes/
fileHashes.bin maps a file’s absolute path to its content hash, recording the file’s length and
modification time with it. Gradle reuses an entry only while length and modification time are
unchanged. The user-home copy covers files inside Gradle’s global caches, such as downloaded
dependency artifacts. Files in the project are tracked in the project’s own
.gradle/<version>/fileHashes/. resourceHashesCache.bin and
KotlinMetadataCompatibilityCache.bin are keyed by content hashes instead of paths.
Restored fileHashes.bin entries only hit when GRADLE_USER_HOME has the same absolute path and
the restored files keep exactly the recorded length and modification time. The saving is
rehashing those cached files. The databases grow with every hashed file and would be transferred in
full on every change.
javaCompile/
classAnalysis.bin maps the content hash of a class file to its analysis (referenced classes,
constants and similar dependency information). jarAnalysis.bin maps the content hash of a
classpath entry, such as a JAR, to the analysis of all its classes. The keys are content hashes,
so unlike fileHashes.bin the entries are not tied to absolute paths.
Gradle’s incremental Java compiler uses this data. Incremental compilation is enabled by default.
After every JavaCompile execution that compiles, including a full compile on a fresh runner,
Gradle analyzes the output classes and snapshots the complete compile classpath. It stores the
result in the task’s previous-compilation-data.bin for the next incremental compile. Restored
entries for unchanged dependency JARs can therefore save work even on fresh CI runners. Tasks
restored from the build cache do not compile and do not use the analysis.
The directory is still a poor fit for Mammoth:
- Each file is one mutable database that every build rewrites in place. Independent workers produce different whole files that cannot be merged; selecting one producer discards the other workers’ entries.
- The files grow with every analyzed class and JAR and have no per-entry cleanup, so every change transfers the complete file again. A medium-sized local user home can reach tens of megabytes.
A build that wants to measure the benefit can add a custom partition for
caches/*/javaCompile/** with a single producer. Gradle logs
Created classpath snapshot for incremental compilation in … at --info level, which shows
the time the classpath analysis takes with and without the restored databases.
dependencies-accessors/
Gradle generates Java accessors for version catalogs (libs.… in build scripts), compiles them
and stores the result as an immutable workspace: <40-hex-key>/ containing metadata.bin,
sources/ and classes/. The store is a fine-grained cache, like the Kotlin DSL stores, with
locks and cleanup markers under .internal/. Gradle checks a workspace against its
metadata.bin before reusing it, as for the Kotlin DSL workspaces below. A miss costs a source
generation and a javac run for each distinct catalog. The dependencies-accessors partition
captures complete workspaces, selects one producer per key and excludes the bookkeeping, as the
Groovy DSL partition does. The Gradle 9.9.3 mixed-workspace integration test covers it.
zinc-<zinc>_<scala>_<java>/
Gradle’s Scala plugin compiles the Zinc compiler bridge from its source JAR once per combination
of Zinc version, Scala version and Java major version, and stores it as compiler-bridge.jar
in this directory. Scala 3 ships a precompiled bridge, but Gradle still creates the directory
with only its lock. The JAR is small and produced in one step. The zinc-compiler-bridges
partition captures each directory with a compiler-bridge.jar as one unit and selects one
producer per directory, since independently compiled bridges are not guaranteed to be
byte-identical. A directory without the JAR is not captured. No Scala build has been
run against this partition yet; tests cover its layout.
Execution history
Gradle’s execution history (task and work-unit input/output fingerprints with timestamps) lives
in the project cache directory, <project>/.gradle/<version>/executionHistory/, not in the
Gradle user home. See Project cache directory.
Kotlin DSL workspaces
Independent producers can generate the same workspace key with different origin
metadata. The built-in kotlin-dsl partition captures complete units
under caches/<version>/kotlin-dsl/ and selects one producer per root with
choose-worker-directory. It retains all metadata, files and empty directories.
The supported layouts are:
scripts/<32-hex>/: nonemptymetadata.bin,classes/andinstrumented/classes/directories, with other outputs such asreports/.accessors/<32-hex>/(Gradle 9.7 and later): nonemptymetadata.bin,classes.jarandsources.jar, as declared by the Gradle 9.9.3 accessor implementation.accessors/<32-hex>/with directory outputs (Gradle 9.6 and earlier): nonemptymetadata.bin,classes/andsources/, as declared by the Gradle 9.6.1 accessor implementation.accessors/<32-hex>-PS/(plugin-spec accessors) andaccessors/<32-hex>-VC/(version-catalog accessors, generated when the build declares a catalog): nonemptymetadata.bin,classes/andsources/directories. Both are units of work ofAbstractStage1BlockAccessorsUnitOfWork, whose identity is<classloader-hash>-<suffix>and whose outputs areclasses/andsources/; the Gradle 8.7, 9.7.1, 9.8.1 and 9.9.2 sources define only these two suffixes.ic/<32-hex>/(Gradle 9.9 and later): mutable incremental-compilation state for one script, with requiredoutputs/andsources/directories and, from the script’s second compile on,ic-state/. Unlike the workspaces above, the key hashes the script’s absolute path, compile stage, target, kind and compiler options, not its content, and Gradle rewrites the entry in place under a per-script lock (KotlinDslIncrementalCompilationCache). Gradle compiles intooutputs/and copies the classes into a newscripts/<32-hex>/workspace. A restored entry therefore only helps when a script misses itsscripts/workspace, and only for a checkout at the same absolute path. Whole-unit handling keeps one producer’soutputs/,sources/andic-state/together. Gradle discards an entry whosecompile-in-progressmarker survived a killed compile, and falls back to a full compile when incremental compilation fails.
Gradle 9.9 also adds classpath-snapshots/snapshots/<content-hash>.abi and .snapshot
files, one pair per script-classpath entry
(KotlinDslClasspathEntrySnapshotCache).
Every build reads the .abi hashes to key the scripts/ workspaces; recompiles read the
.snapshot files. Both are immutable and content-addressed, so the kotlin-dsl partition
keeps them as ordinary files, and their classpath-snapshots/gc.properties cleanup marker is
excluded.
Gradle reuses an existing workspace only when the output hashes recorded in its
metadata.bin match the current outputs, and otherwise regenerates it, so a
restored whole-unit copy is safe to reuse
(AssignImmutableWorkspaceStep).
Gradle 9.8.1 and 9.9.2 open kotlin-dsl/accessors/ and kotlin-dsl/scripts/ (9.9 also
kotlin-dsl/ic/) as fine-grained caches whose .internal/ directories hold locks and cleanup markers
(gc.properties, gc/<key>/soft.deleted); the kotlin-dsl partition excludes them.
The JAR, -PS and -VC layouts were observed with Gradle 9.8.1 (-PS and -VC also with 8.7),
and the ic/ and classpath-snapshots/ layouts with Gradle 9.9.0 to 9.9.3;
the unsuffixed directory variant also has synthetic coverage based on the source above; unknown or incomplete modern
layouts are skipped with bounded warnings. Partial ownership fails capture.
Required directories may be empty. Legacy caches/<version>/scripts/ content and
generated Gradle API JARs retain ordinary strict handling in the same partition.
Native objects carry literal managed files and directories. Guarded native
placement, same-operation cleanup and whole-unit GC are shared with Groovy.
The default conflict policy rejects differing complete worker views.
Groovy DSL workspaces
The default groovy-dsl partition covers completed
caches/<version>/groovy-dsl/<32-lowercase-hex-key>/ workspaces. The outer
metadata.bin records build origin and output information; it is distinct from
metadata/metadata.bin. Removing it can force recompilation or fail older Gradle
loaders. Both files travel with classes/, instrumented/ and other workspace
outputs. Empty output directories matter: losing an empty instrumented/ directory
caused Gradle 9.8.1 to invalidate a restored workspace in local qualification.
Mammoth checks structural completeness, file membership, directory topology and payload integrity. It does not decode Gradle binary metadata or prove semantic compatibility for every Gradle release. Unknown roots and incomplete source layouts are skipped with bounded diagnostics. Partial configured membership fails capture. Cleanup state, locks and temporary roots are excluded.
Workers upload complete changed workspaces. choose-worker-directory selects the
smallest producer job name for overlapping views, preserving metadata and outputs
from one producer together. Distinct workspace keys can come from different workers.
Unused keys from another project may remain cached. The family excludes the local
GRADLE_USER_HOME path. Incoming unit replacement operates on managed contents
through guarded native placement. GC works on complete units.
A nonempty Groovy base partition uses a native object containing its literal files and directories with a bounded identity descriptor. Metadata-visible changes drive reuse. A changed partition can be moved into owned SDK staging and returned after the SDK settles in the same operation. Incoming worker TAR-v2 archives still validate each body and complete unit. Missing base objects can start a partition cold while unrelated validated objects remain available.
Local Linux qualification covered Gradle 8.7 and 9.8.1, relocation, and Java 21/25. The local mixed-workspace integration runs with an installed Gradle executable, Java 21/25 and a Kotlin DSL control. Gradle 8.14.6 and 9.9.1 source inspection informs the metadata requirement; those versions were not runtime-qualified here. Native Windows/macOS and hosted artifact-action parity remain unqualified. These results establish reuse for the tested fixtures, with no general performance or universal compatibility claim.
Journal and lock files
caches/journal-1/file-access.bin — An indexed cache that maps the absolute paths of cached
files and directories to their last access time. Gradle’s cache cleanup uses it to find unused
entries. For a path without a journal entry, Gradle uses the later of the journal’s creation time
and the file’s modification time. The journal is shared by all Gradle versions. It describes one
machine’s files by absolute path, so a restored copy would drive cleanup decisions with another
machine’s access times.
*.lock files — Gradle coordinates access across processes with operating-system file locks on
these files. A lock file also stores the cache’s lock state and information about the owner, such
as its PID and the port Gradle uses to ask the owner to release the lock. A restored lock file holds
no operating-system lock. Its stored state can mark a cache as not closed cleanly, and Gradle then
deletes and recreates caches that have an initializer, such as workerMain/ and cc-keystore/.
Gradle creates lock files when it needs them, and its
cache-copy guidance
says not to copy them.
Both journal-1/** and **/*.lock are unconditional hard excludes in this action.
Project cache directory
Gradle keeps per-build state in the project cache directory of the root build,
<project>/.gradle/. Mammoth caches the Gradle user home only, and none of this state helps on
a fresh runner: it is keyed by absolute paths and file modification times, describes outputs
under build/ that a fresh checkout does not have, or is local to one host or process.
| Path | Content | Why it is not cached |
|---|---|---|
<version>/executionHistory/ |
Up-to-date state for each task and work unit: input fingerprints and snapshots of the outputs it produced, by absolute path | Without the build/ outputs, tasks see them as removed and run again or load from the build cache |
<version>/fileHashes/, <version>/checksums/ |
Hashes and checksums of project files, keyed by absolute path, length and modification time | A fresh checkout gives every file a new modification time, so every entry misses |
<version>/kotlin-dsl-plugin-entries/ |
Plugin IDs found in plugin JARs, keyed by the JAR’s MD5 | Portable, but a few kilobytes and cheap to rebuild |
<version>/fileChanges/, file-system.probe |
File-system watching state | Local to one host and daemon |
<version>/vcsMetadata/, vcs-1/ |
Source-dependency checkouts | Rarely used; repositories are cloned again |
buildOutputCleanup/ |
Output paths Gradle created, used to delete stale outputs | Describes build/, which is not restored |
workspace-id.txt |
Workspace ID reported in build scans | A restored ID would make all jobs report the same workspace |
configuration-cache/ |
Configuration cache entries | See Configuration cache |
Builds and tools may create other directories there, such as a Gradle user home passed with
-g .gradle; those are not part of Gradle’s project cache.
Configuration cache
The Gradle configuration cache saves the result of the configuration phase in the project’s
.gradle/configuration-cache/ directory, not in the Gradle user home. Entries can contain
credentials and other values held in task state, and the system properties and environment
variables read during configuration. Gradle encrypts the entries with a key from the keystore in
caches/<version>/cc-keystore/, or from the GRADLE_ENCRYPTION_KEY environment variable. Anyone
with both the entries and the key can read them; see Gradle’s
configuration cache security considerations.
This action never transports the keystore.
CVE-2023-30853 affected
gradle/gradle-build-action before 2.4.2: it saved configuration-cache data, which can contain
secrets, to the GitHub Actions cache. Treat configuration-cache entries and their key as
local-only data.
Mammoth does not cache configuration-cache entries. An entry is reused only when the encryption
key, the Gradle user home path, the JVM, the requested tasks and start parameters match, and every
recorded input file still has the same absolute path and content. Every distinct command line
produces its own entry. Caching entries would need a second cache root inside the checkout, a
required GRADLE_ENCRYPTION_KEY secret shared by all jobs, and handling for entries that contain
credentials. A hit skips only the configuration phase, after Gradle has checked the recorded
inputs, which saves little in most builds. Gradle recommends
read-only mode
on ephemeral CI runners instead.
Native libraries: native/
Gradle loads native libraries through JNI: native-platform for process, terminal, file-system and
system information, gradle-fileevents for file-system watching, and Jansi for console output.
It extracts them from JARs in its distribution into native/ the first time it needs them. The
org.gradle.native.dir system property or environment variable moves this directory elsewhere.
Observed layouts include:
| Path | Contents |
|---|---|
native/<id>/<platform>/ |
native-platform libraries, such as file-event support |
native/<version>/<target-triple>/ |
gradle-fileevents libraries |
native/jansi/<version>/<os>/<arch>/ |
Jansi console libraries |
<id> is either a small number or a 64-hex-digit hash. <platform> names an OS and architecture,
such as linux-amd64 or linux-amd64-ncurses6. Each library has a .lock file next to it.
The directory is not worth caching:
- The libraries come from the Gradle distribution, which
wrapper/dists/already caches. Extracting them takes no network access and very little time. - The whole directory is small, typically a few megabytes.
- Only the lowest directory level names the platform; hash-named roots do not say which
operating system they are for. Cache families are shared across operating systems and
architectures, so workers on Linux, Windows and macOS would mix their libraries in one
partition unless each platform uses its own
cache-key-prefix. - Gradle does not always verify an existing library. For example, it copies the Jansi library only when the file is missing. A restored library that is truncated or built for another platform can make Gradle fail while starting, which costs more than extracting it again.
Java toolchains: jdks/
With toolchain auto-provisioning,
Gradle downloads a missing JDK and unpacks it into jdks/, one directory per JDK. It unpacks
into a temporary directory first, moves the result into jdks/ and then writes a .ready
marker, plus the legacy provisioned.ok for older Gradle versions. Gradle uses a directory
only when the marker exists. caches/<version>/jvms/ is a different store: metadata Gradle
records after probing installed JVMs.
A JDK is a download of roughly 200 MB, often from a vendor CDN. No built-in partition
includes jdks/. Its JDKs are specific to one OS and architecture, a build may provision
several, and a restore must keep executable file modes and never present a partly unpacked
JDK as ready. Most CI workflows install JDKs before the build, for example with
actions/setup-java, and do not rely on auto-provisioning.
Directories created by plugins and builds
Other tools also write to the Gradle user home:
| Directory | Written by | Contents |
|---|---|---|
nodejs/ |
Kotlin Gradle plugin (Kotlin/JS) | Extracted Node.js distributions with a .hash file each |
yarn/ |
Kotlin Gradle plugin (Kotlin/JS) | Extracted Yarn distributions with a .hash file each |
kotlin-profile/ |
Kotlin Gradle plugin statistics | Usage-statistics files, pruned by count and age |
test-kit/ etc. |
Builds that configure TestKit | Nested Gradle user homes used by functional tests |
The Kotlin Gradle plugin downloads the Node.js and Yarn archives through a Gradle Ivy repository,
so the archives are stored in caches/modules-2/files-2.1/ like other dependencies. It then
extracts them into nodejs/ and yarn/ and skips the extraction while the archive hash matches
the .hash file. Caching files-2.1/ therefore already avoids the downloads; the extracted
directories are large and quick to recreate.
TestKit uses the test worker’s temporary directory by default. A TestKit directory inside the
Gradle user home exists only when a build sets it through org.gradle.testkit.dir or
GradleRunner.withTestKitDir(). It is a complete second Gradle user home, including daemon
state.
Portability summary
Included by default, subject to the compatibility and content rules above:
| Pattern | Role |
|---|---|
caches/modules-2/files-2.1/** |
Immutable external artifacts |
caches/jars-*/** |
Instrumented build-logic JARs |
caches/build-cache-1/** |
Task output snapshots |
wrapper/dists/** |
Downloaded Gradle distributions |
caches/transforms-4/<key>/** |
Complete recognized transform workspaces |
caches/<version>/transforms/<key>/** |
Complete recognized transform workspaces |
caches/modules-2/resources-*/** |
Resources fetched by URL |
caches/<version>/dependencies-accessors/<key>/** |
Compiled version-catalog accessors |
caches/<version>/zinc-*/** |
Compiled Scala compiler bridges |
Compiled Kotlin DSL scripts and generated Gradle API JARs are also included by the
kotlin-dsl partition; recognized Kotlin and Groovy workspaces use the complete-unit
transport above.
Always excluded:
| Pattern | Reason |
|---|---|
**/*.lock |
Local lock state and owner information |
caches/*/cc-keystore |
Configuration-cache encryption key material |
caches/journal-1/** |
Local access times keyed by absolute paths |
Omitted by defaults, but configurable through custom partitions:
| Pattern | Reason for default omission |
|---|---|
caches/<version>/fileHashes/** |
Indexes keyed by absolute paths and timestamps |
caches/<version>/javaCompile/** |
Unmergeable mutable databases |
caches/<version>/md-*/** |
Unmergeable mutable databases |
daemon/** |
Local PIDs and ephemeral logs |
native/** |
Platform-specific; regenerated on demand |
jdks/** |
Large, platform-specific JDK installations |
nodejs/**, yarn/** |
Extracted from archives already in files-2.1 |
kotlin-profile/** |
Local usage statistics |
Dependency metadata is cached separately as complete dependency-metadata snapshots under
caches/modules-2/metadata-*/**. It is relocatable with compatible Gradle cache formats; locks and
caches/modules-*/**/gc.properties are omitted.
The optional dependency layer supports
the files-2.1 artifact directory and restored metadata-* directories under modules-2.
Gradle selects the metadata layout it understands. The jars-* store and modules-2/resources-*
stay in the writable module-support partition, so a worker using the layer fetches resources
that its read-only metadata refers to again.