Skip to content
Latchkey

Gradle "Could not resolve all dependencies" - Fix in CI

Gradle could not fetch one or more dependencies for a configuration. Either no declared repository has the artifact, the coordinate is wrong, a private repo refused the request, or the registry was briefly unreachable.

What this error means

The build fails with Could not resolve all dependencies for configuration ... and a Could not find <group:name:version> or Could not GET ... cause. A resolution that fails on a network timeout and clears on re-run is transient; a missing-coordinate failure is deterministic.

gradle
* What went wrong:
Could not resolve all dependencies for configuration ':app:runtimeClasspath'.
> Could not find com.example:lib:1.4.0.
  Searched in the following locations:
    - https://repo.maven.apache.org/maven2/com/example/lib/1.4.0/lib-1.4.0.pom

Common causes

Repository not declared or artifact absent

The artifact lives on a repo (e.g. a private Nexus) that is not in the repositories {} block, or the coordinate is misspelled, so no configured location has it.

Private-repo authentication missing

The dependency is on an authenticated feed, but the credentials are not wired into the repository declaration on the runner, so the GET is refused.

Transient registry timeout

A brief network blip or a slow Maven Central mirror makes the GET fail; the same build succeeds on retry.

How to fix it

Declare the repository and verify the coordinate

Add every repository the build needs and confirm the exact group:name:version exists there.

build.gradle.kts
repositories {
  mavenCentral()
  maven {
    url = uri("https://nexus.example.com/repo")
    credentials {
      username = System.getenv("NEXUS_USER")
      password = System.getenv("NEXUS_TOKEN")
    }
  }
}

Inspect the resolution

  1. Run ./gradlew :app:dependencies --configuration runtimeClasspath to see what Gradle is trying to resolve.
  2. Fix the coordinate, or add the missing repository, until the artifact resolves.
  3. For a private feed, confirm the CI secret feeding the credentials block is present and non-empty.

How to prevent it

  • Pin dependency versions and declare all repositories explicitly in version control.
  • Inject private-repo credentials from CI secrets, never inline.
  • On Latchkey, self-healing managed runners auto-retry transient registry timeouts so a brief Maven Central blip does not fail resolution on its own.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →