Skip to content
Latchkey

Gradle "Could not determine the dependencies of task" - Fix in CI

Before running a task, Gradle resolves the configurations that task depends on. This error means that resolution failed while wiring the task graph - a configuration (e.g. a classpath) could not be assembled, so Gradle cannot even schedule the task.

What this error means

The build fails with Could not determine the dependencies of task ':module:task', followed by a nested Could not resolve/Could not find cause naming the dependency or repository that failed.

gradle output
* What went wrong:
Could not determine the dependencies of task ':app:compileJava'.
> Could not resolve all dependencies for configuration ':app:compileClasspath'.
   > Could not find com.example:lib:2.3.1.
     Searched in the following locations: ...

Common causes

A configuration the task needs cannot resolve

The task’s input configuration (compileClasspath, runtimeClasspath, an annotation-processor path) has a dependency that is missing, on an undeclared repo, or needs auth - so the whole configuration fails.

No variant matches the consumer’s attributes

A dependency that publishes Gradle Module Metadata may have no variant matching your JVM target/attributes, so Gradle cannot select files for the configuration.

How to fix it

Resolve the failing configuration directly

Inspect the exact configuration the task depends on to see what failed.

Terminal
./gradlew :app:dependencies --configuration compileClasspath
./gradlew :app:dependencyInsight --dependency com.example:lib

Declare the repo / fix the coordinates

Add the hosting repository (with credentials if private) or correct the version.

build.gradle.kts
repositories {
    mavenCentral()
    maven { url = uri("https://nexus.example.com/repository/maven-releases/") }
}

How to prevent it

  • Centralize repositories in settings.gradle dependencyResolutionManagement.
  • Use a version catalog so coordinates are defined once.
  • Cache ~/.gradle/caches so configurations resolve from cache after the first run.

Frequently asked questions

What causes ""Could not determine the dependencies of task""?
The task’s input configuration (compileClasspath, runtimeClasspath, an annotation-processor path) has a dependency that is missing, on an undeclared repo, or needs auth - so the whole configuration fails.
How do I fix "Could not determine the dependencies of task"?
Inspect the exact configuration the task depends on to see what failed.
Can Latchkey fix this automatically?
Yes. Latchkey runs your GitHub Actions on managed runners that detect this failure, apply the fix, and retry the job automatically - self-healing is on by default.

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card