java
build_error
ai_generated
true
插件解析异常:插件 [id: 'com.github.johnrengelman.shadow', version: '8.1.1'] 在以下来源中未找到:Gradle 核心插件、插件仓库(无法解析插件工件 'com.github.johnrengelman.shadow:com.github.johnrengelman.shadow.gradle.plugin:8.1.1')
PluginResolutionException: Plugin [id: 'com.github.johnrengelman.shadow', version: '8.1.1'] was not found in any of the following sources: Gradle Core Plugins, Plugin Repositories (could not resolve plugin artifact 'com.github.johnrengelman.shadow:com.github.johnrengelman.shadow.gradle.plugin:8.1.1')
ID: java/gradle-plugin-not-found
80%修复率
85%置信度
0证据数
2024-04-10首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 8+ | active | — | — | — |
根因分析
Gradle 插件未在 pluginManagement 块中声明,或者缺少插件仓库。
English
The Gradle plugin is not declared in the pluginManagement block or the plugin repository is missing.
解决方案
-
95% 成功率 Add the Gradle Plugin Portal to pluginManagement repositories
pluginManagement { repositories { gradlePluginPortal() mavenCentral() } } -
90% 成功率 Declare the plugin directly in build.gradle with correct version
plugins { id 'com.github.johnrengelman.shadow' version '8.1.1' }
无效尝试
常见但无效的做法:
-
Adding the plugin to buildscript dependencies without using pluginManagement
80% 失败
Gradle 8+ requires plugins to be resolved via pluginManagement or direct plugin block with repository.
-
Using an older version of the plugin that is not compatible with Gradle 8
75% 失败
Version incompatibility leads to resolution failure.