Minecraft 1.12.2 Forge模组开发Gradle依赖查找失败求助
Minecraft 1.12.2 Forge模组构建依赖解析失败解决方案
问题重现
开发1.12.2版本Forge模组时,执行构建抛出以下错误:
> Task :compileJava FAILED FAILURE: Build failed with an exception. * What went wrong: Could not resolve all files for configuration ':compileClasspath'. > Could not find net.minecraftforge:forge:1.12.2-14.23.5.2860_mapped_snapshot_20171003-1.12. Searched in the following locations: - https://maven.minecraftforge.net/net/minecraftforge/forge/1.12.2-14.23.5.2860_mapped_snapshot_20171003-1.12/forge-1.12.2-14.23.5.2860_mapped_snapshot_20171003-1.12.pom - https://maven.minecraftforge.net/net/minecraftforge/forge/1.12.2-14.23.5.2860_mapped_snapshot_20171003-1.12/forge-1.12.2-14.23.5.2860_mapped_snapshot_20171003-1.12.jar - file:/C:/Users/techi/.gradle/caches/forge_gradle/bundeled_repo/net/minecraftforge/forge/1.12.2-14.23.5.2860_mapped_snapshot_20171003-1.12/forge-1.12.2-14.23.5.Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/4.9/userguide/command_line_interface.html#sec:command_line_warnings BUILD FAILED in 1m 37s 1 actionable task: 1 executed
已排查build.gradle配置、确认MDK完整性、刷新依赖,但问题未解决。
解决步骤
校验依赖版本完整性:打开项目根目录的
build.gradle,找到minecraft代码块,确认version和mappings配置为完整的合法值:minecraft { version = "1.12.2-14.23.5.2860" mappings = "snapshot_20171003" // 其他配置项... }错误日志中依赖版本号存在截断,需确保配置无拼写错误或格式缺失。
清理Gradle缓存并重建依赖:
- 删除本地缓存目录:
C:/Users/techi/.gradle/caches/forge_gradle/bundeled_repo - 在项目根目录执行命令:
gradlew clean build --refresh-dependencies,强制清理构建缓存并重新拉取所有依赖。
- 删除本地缓存目录:
重新生成MDK项目:若上述步骤无效,下载对应版本的Forge MDK(1.12.2-14.23.5.2860),解压后将模组代码迁移至新项目中,避免原项目配置文件损坏。
检查网络与代理配置:确认网络可正常访问Maven仓库,若使用代理,在
gradle.properties中添加代理配置:systemProp.http.proxyHost=你的代理地址 systemProp.http.proxyPort=代理端口 systemProp.https.proxyHost=你的代理地址 systemProp.https.proxyPort=代理端口
内容的提问来源于stack exchange,提问作者eepyfemboi
相关产品推荐
相关产品推荐

