Gradle "Plugin [id: 'x'] was not found in any of the following sources" - Fix in CI
Gradle resolved your plugins {} block and could not find the plugin id (and version) in any configured plugin source. Either the coordinates are wrong, the version is missing, or the repository that hosts it is not declared.
What this error means
Configuration fails with Plugin [id: 'com.example.foo', version: '1.2.3'] was not found in any of the following sources: followed by a list (Gradle Core, Plugin Portal, included builds). The build never reaches task execution.
* What went wrong:
Plugin [id: 'org.example.greeting', version: '1.0.0'] was not found in any
of the following sources:
- Gradle Core Plugins (not a core plugin...)
- Plugin Repositories (could not resolve plugin artifact
'org.example.greeting:org.example.greeting.gradle.plugin:1.0.0')Common causes
Wrong plugin id or missing version
A typo in the id, or a community plugin applied with no version, leaves Gradle unable to resolve a marker artifact.
Plugin lives on a repo not declared in pluginManagement
A custom or third-party plugin is hosted on a private registry that is not listed in settings.gradle pluginManagement { repositories }.
Plugin Portal unreachable
A locked-down runner cannot reach plugins.gradle.org, so the marker artifact cannot be fetched.
How to fix it
Fix the id and pin a version
Use the exact plugin id and an existing version in the plugins block.
plugins {
id 'org.example.greeting' version '1.0.1'
}Declare the hosting repository
Add the plugin repository in settings so Gradle knows where to look.
// settings.gradle
pluginManagement {
repositories {
gradlePluginPortal()
maven { url 'https://nexus.example.com/repository/gradle-plugins/' }
}
}Map the id to coordinates explicitly
For non-portal plugins, resolve the id to a module via a resolution strategy.
pluginManagement {
resolutionStrategy {
eachPlugin {
if (requested.id.id == 'org.example.greeting')
useModule("org.example:greeting-plugin:${requested.version}")
}
}
}How to prevent it
- Declare all plugin repositories in
settings.gradlepluginManagement. - Pin plugin versions; do not apply community plugins without a version.
- Mirror the Plugin Portal through a proxy on locked-down runners.