Skip to content
Latchkey

Gradle "Could not resolve all artifacts for configuration" in CI

Gradle failed to download every artifact for a configuration - frequently the :classpath configuration that holds build-script and plugin dependencies. A repository is missing or a coordinate is wrong.

What this error means

Resolution fails with Could not resolve all artifacts for configuration ':classpath' (or another configuration), followed by the specific Could not find/Could not resolve artifact and the locations searched.

gradle output
* What went wrong:
A problem occurred configuring root project 'app'.
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not find com.example:build-plugin:1.0.0.

Common causes

buildscript repository not declared

Build-script/plugin dependencies resolve from the buildscript { repositories {} } (or pluginManagement) block. If the hosting repo is missing there, the classpath configuration cannot resolve.

Wrong coordinates for a plugin artifact

A typo or a non-existent version of a plugin/build dependency leaves the configuration unresolvable.

How to fix it

Declare the buildscript repository

Add the repo that hosts the build-script dependency to the buildscript block.

build.gradle.kts
buildscript {
    repositories {
        mavenCentral()
        maven { url = uri("https://nexus.example.com/repository/gradle-plugins/") }
    }
    dependencies {
        classpath("com.example:build-plugin:1.0.0")
    }
}

Identify the unresolved artifact

List the failing configuration to see exactly what is missing and where Gradle searched.

Terminal
./gradlew buildEnvironment
./gradlew dependencies --configuration classpath

How to prevent it

  • Declare buildscript/pluginManagement repositories explicitly, pin plugin/build-dependency versions, and mirror internal plugin artifacts.

Frequently asked questions

What causes ""Could not resolve all artifacts for configuration""?
Build-script/plugin dependencies resolve from the buildscript { repositories {} } (or pluginManagement) block. If the hosting repo is missing there, the classpath configuration cannot resolve.
How do I fix "Could not resolve all artifacts for configuration"?
Add the repo that hosts the build-script dependency to the buildscript block.

Related guides

References

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