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.
* 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.
./gradlew :app:dependencies --configuration compileClasspath
./gradlew :app:dependencyInsight --dependency com.example:libDeclare the repo / fix the coordinates
Add the hosting repository (with credentials if private) or correct the version.
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/cachesso configurations resolve from cache after the first run.