升级Groovy至3.0.15后IntelliJ提示无法解析groovy-all-3.0.15-indy.jar
问题解决:IntelliJ刷新Gradle时找不到groovy-all-3.0.15-indy.jar
问题原因
Groovy 3.x版本起,groovy-all不再提供indy变体的jar包,而IntelliJ的Gradle刷新功能可能读取到了你项目中遗留的旧配置(比如开启了Groovy的indy选项),导致它尝试拉取不存在的文件。命令行执行build成功是因为终端环境没有触发这些旧配置逻辑。
解决方案
清理Groovy相关的indy配置
检查你的build.gradle或settings.gradle文件,移除任何包含indy的配置项,比如:// 移除这类配置 groovy { indy = true } // 或者移除依赖中带classifier的写法 implementation group: 'org.codehaus.groovy', name: 'groovy-all', version: '3.0.15', classifier: 'indy'替换groovy-all为具体依赖模块
Groovy 3.x拆分了groovy-all的内容,你可以根据项目需要引入具体的Groovy模块,替代单一的groovy-all,比如:implementation 'org.codehaus.groovy:groovy:3.0.15' implementation 'org.codehaus.groovy:groovy-json:3.0.15' implementation 'org.codehaus.groovy:groovy-xml:3.0.15' implementation 'org.codehaus.groovy:groovy-sql:3.0.15' // 其他项目用到的模块按需添加这样既能满足依赖需求,又不会触发indy相关的拉取逻辑。
清理IntelliJ缓存
打开IntelliJ,依次点击File → Invalidate Caches...,勾选"Clear file system cache and local history"后重启IDE,避免旧缓存干扰配置读取。对齐Gradle版本
确认IntelliJ使用的Gradle版本和你终端执行的一致:打开File → Settings → Build, Execution, Deployment → Build Tools → Gradle,选择"Use Gradle from"为项目本地的Gradle版本。
内容的提问来源于stack exchange,提问作者jega
相关产品推荐
相关产品推荐

