Gradle "Could not resolve all dependencies for configuration" in CI
Gradle tried to download every artifact for a configuration and at least one failed. The nested "Could not find" or "Could not GET" lines under the summary name the exact coordinate and repository that failed.
What this error means
The build stops with "Could not resolve all dependencies for configuration ':app:runtimeClasspath'" followed by one or more nested causes naming the artifact and the repository URL it tried.
* What went wrong:
Execution failed for task ':app:compileJava'.
> Could not resolve all dependencies for configuration ':app:runtimeClasspath'.
> Could not find com.example:internal-lib:1.4.0.
Searched in the following locations:
- https://repo.maven.apache.org/maven2/com/example/internal-lib/1.4.0/internal-lib-1.4.0.pomCommon causes
The hosting repository is not declared
The artifact lives in a private or third-party repository that is missing from the repositories {} block, so Gradle only searches Maven Central and never finds it.
A transient network failure to one repository
A momentary DNS or TLS failure to a repository host makes a single artifact unresolvable, even though the coordinate exists.
How to fix it
Declare the repository that hosts the artifact
- Read the nested "Could not find" cause to see the exact coordinate.
- Add the repository that actually publishes it to
repositories {}. - Re-run so Gradle searches that location.
repositories {
mavenCentral()
maven { url = uri("https://maven.internal.example.com/releases") }
}Retry a transient resolution failure
If the coordinate exists but the download flaked, re-running resolves it. Cache the Gradle dependency directory so a good download persists.
- uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}How to prevent it
- Declare every repository your artifacts come from, including internal ones.
- Cache ~/.gradle/caches so resolved artifacts persist across runs.
- Pin coordinates that exist in the repositories you declare.