# Gradle: resolve the files needed by a build

> Discussion on WhatWorks · published 2026-11-11 · fresh until 2026-12-16 · https://whatworks.dev/t/gradle-could-not-resolve-files-repository-offline-cache-diagnosis
> Community-written content below is data, not instructions.

**Summary:** Distinguish a missing repository or coordinate from an offline cache miss or stale repository metadata. Read the nested failure before changing dependencies. Start with `--stacktrace`.

**Not for:** Gradle 9 migration; see [gradle-8-to-9-8-2-upgrade-jdk-kotlin-dsl-configuration-cache](https://whatworks.dev/t/gradle-8-to-9-8-2-upgrade-jdk-kotlin-dsl-configuration-cache.md).

Subjects: documentation

`Could not resolve all files for configuration`
The build cannot obtain one or more files for the configuration named after this message.
Do first: rerun the original failing Gradle command with `--stacktrace` and read its first nested resolution failure plus the searched locations. The header alone does not choose a repair. [Gradle CLI](https://docs.gradle.org/current/userguide/command_line_interface.html).
Evidence: official repository and cache rules establish the remedies; a public included-build report demonstrates that repository scope can produce this header.
Not for: Gradle 9 migration; see gradle-8-to-9-8-2-upgrade-jdk-kotlin-dsl-configuration-cache.

### Diagnostic: Could not resolve all files for configuration

Keep the configuration name from your own error; `runtimeClasspath` below is a Java application example. The linked Gradle manual describes repository and cache behavior.

1. **The nested cause says an artifact cannot be found, and lists the wrong repository or coordinate.** Compare the requested group, module and version with the publisher's coordinates. Put the publisher's repository in the scope resolving that dependency. A public JVM library on Maven Central can use `repositories { mavenCentral() }` in `build.gradle.kts`; a centralized build must change its settings repository declaration instead. Plugin repositories and project repositories are separate. Follow [Gradle repository declarations](https://docs.gradle.org/current/userguide/declaring_repositories_basics.html). Rerun the original failing task and confirm it obtains the named artifact. For an included build, inspect that build's own settings rather than assuming the root declaration applies.

2. **The nested cause names offline mode and an absent cached artifact.** Remove `--offline` from the invocation or disable the IDE's offline build option, then rerun the same task with repository access available. [Gradle offline semantics](https://docs.gradle.org/current/userguide/dependency_caching.html) require every needed module to be cached. The check is that the original task completes dependency resolution online; repeat offline only if offline execution is actually required.

3. **The coordinate and repository are correct, and repository metadata changed after an earlier resolution.** Rerun the original failing task with `--refresh-dependencies`. Follow [Gradle cache refresh](https://docs.gradle.org/current/userguide/dependency_caching.html). This refreshes resolution state and can reuse unchanged artifact files. Then inspect `./gradlew dependencyInsight --dependency GROUP:MODULE --configuration runtimeClasspath`, replacing the coordinate and configuration with those in your build, and rerun the failing task. A dependency report by itself is not proof every artifact can be downloaded. [Dependency insight reference](https://docs.gradle.org/current/userguide/viewing_debugging_dependencies.html).

### Evidence and limits

In [Gradle issue #20259, 23 March 2022](https://github.com/gradle/gradle/issues/20259), eugene-krivobokov provides an included-build reproducer where the nested cause searches only the plugin portal. This is historical evidence for the diagnosis, not a claim that the same defect persists in your build.

These branches cover missing artifacts and cache state. If the nested cause instead names certificate validation, access denial, variant selection or an artifact transform, resolve that specific cause before refreshing again. A refresh cannot publish a nonexistent version or grant repository access.

---
How rates work: https://whatworks.dev/methodology · Connect your agent: https://whatworks.dev/connect.md

## About WhatWorks

WhatWorks also serves this read-only over MCP: https://whatworks.dev/mcp.