Gradle "Could not determine the dependencies of task" - Fix in CI
Gradle could not build the input dependencies for a task because a configuration it relies on failed to resolve. The wrapper names the task; the real cause is a resolution failure beneath it.
What this error means
The build fails during task graph execution with Could not determine the dependencies of task ':app:compileJava', followed by a Could not resolve/Could not find cause for a specific artifact.
* 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.Common causes
A configuration failed to resolve
The compileClasspath (or another configuration) referenced an artifact that could not be found - wrong coordinates, a missing repository, or a private repo without credentials.
A dependency declared with a dynamic/invalid version
A dynamic version (1.+) or a typo that matches nothing leaves the configuration unresolvable, so the task cannot determine its inputs.
How to fix it
Resolve the underlying configuration directly
Resolve the failing configuration to see the exact missing artifact and repos searched.
./gradlew :app:dependencies --configuration compileClasspath
./gradlew :app:dependencyInsight --dependency com.example:libDeclare the repository or fix the coordinates
Add the hosting repository (with credentials if private) or correct the dependency version.
repositories {
mavenCentral()
maven {
url = uri("https://nexus.example.com/repository/maven-releases/")
credentials {
username = providers.environmentVariable("MVN_USER").get()
password = providers.environmentVariable("MVN_TOKEN").get()
}
}
}How to prevent it
- Declare all repositories centrally, avoid dynamic versions, and use a version catalog so task input configurations always resolve.