java build_error ai_generated true

Could not resolve all dependencies for configuration

ID: java/gradle-dependency-resolution

Also available as: JSON · Markdown
85%Fix Rate
88%Confidence
70Evidence
2023-01-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
8 active

Root Cause

Gradle dependency resolution failure occurs when Gradle cannot find a declared dependency in any configured repository, when version constraints conflict, or when network issues prevent downloading artifacts.

generic

Workarounds

  1. 88% success Verify the dependency coordinates (groupId, artifactId, version) are correct and the repository is configured
    1. Search for the dependency on search.maven.org to verify the correct coordinates. 2. Check that the repository hosting the artifact is declared in build.gradle: repositories { mavenCentral() } or the appropriate custom repository URL. 3. For private/internal artifacts, ensure the repository URL, credentials, and authentication are configured correctly. 4. Run './gradlew dependencies --configuration runtimeClasspath' to see the full resolution result.
  2. 82% success Use Gradle's dependency resolution strategy to handle version conflicts explicitly
    1. Add a resolution strategy: configurations.all { resolutionStrategy { failOnVersionConflict() } } to surface conflicts. 2. Force specific versions: resolutionStrategy { force 'group:artifact:version' }. 3. Use a platform/BOM: implementation platform('org.springframework.boot:spring-boot-dependencies:3.2.0') for consistent versions. 4. Check network connectivity and proxy settings if artifacts cannot be downloaded. 5. Run with --refresh-dependencies to bypass the cache if a corrupted artifact is suspected.

Dead Ends

Common approaches that don't work:

  1. Adding mavenLocal() as the first repository to work around resolution failures 60% fail

    mavenLocal() uses the local Maven repository (~/.m2/repository), which may contain stale, corrupted, or snapshot artifacts. Builds that depend on mavenLocal() are not reproducible across machines. It can mask real resolution problems by serving outdated artifacts.

  2. Disabling dependency verification or checksum validation to force resolution 75% fail

    Dependency verification exists to prevent supply chain attacks and corrupted downloads. Disabling it may allow tampered or incomplete artifacts to be used, introducing security vulnerabilities or hard-to-diagnose runtime errors.

Error Chain

Leads to:
Preceded by:
Frequently confused with: