Spring Boot 3.2.x源码构建失败:Gradle任务无法推进求助
Spring Boot 3.2.x源码构建失败求助
我用命令 ./gradlew format clean publishToMavenLocal -x test &> log 从源码构建Spring Boot 3.2.x,但构建失败。错误显示任务无法推进,有任务排队等待执行但均无法启动,同时提示使用了废弃的Gradle特性。已搜索相关问题但未找到类似案例,附上详细信息寻求解决方案:
错误日志
- 等待执行的工作进程:4
- 已停止的工作进程:1
构建失败,出现异常。
- 问题原因:无法推进任务执行,有任务排队但没有一个能启动
- 建议操作:
使用--stacktrace选项获取堆栈跟踪;使用--info或--debug选项获取更多日志输出。本次构建使用了与Gradle 8.0不兼容的废弃特性。可使用
--warning-mode all查看具体废弃警告,确认其来源。为保证构建正确性,本次构建中96个无效工作单元的执行优化已被禁用,详情参考废弃警告。
构建耗时6分11秒,失败。
共801个可执行任务:798个已执行,1个来自缓存,2个已更新因未在'ge.spring.io'服务器认证,未发布构建扫描。
build.gradle配置
plugins { id "base" id "org.jetbrains.kotlin.jvm" apply false // https://youtrack.jetbrains.com/issue/KT-30276 id "io.spring.nohttp" version "0.0.11" } description = "Spring Boot Build" defaultTasks 'build' nohttp { allowlistFile = project.file("src/nohttp/allowlist.lines") source.exclude "**/bin/**" source.exclude "**/build/**" source.exclude "**/out/**" source.exclude "**/target/**" source.exclude "**/.settings/**" source.exclude "**/.classpath" source.exclude "**/.project" source.exclude "spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/test/resources/org/springframework/boot/buildpack/platform/docker/export.tar" } check { dependsOn checkstyleNohttp } allprojects { group "org.springframework.boot" repositories { mavenCentral() if (version.contains('-')) { maven { url "https://repo.spring.io/milestone" } } if (version.endsWith('-SNAPSHOT')) { maven { url "https://repo.spring.io/snapshot" } } } configurations.all { resolutionStrategy.cacheChangingModulesFor 0, "minutes" } } tasks.named("checkstyleNohttp").configure { maxHeapSize = "1536m" }
环境信息
- JDK:openjdk version "17-internal" 2021-09-14,OpenJDK Runtime Environment (build 17-internal+0-adhoc.root.crac),OpenJDK 64-Bit Server VM (build 17-internal+0-adhoc.root.crac, mixed mode, sharing)
- Gradle:7.6.4,构建时间: 2024-02-05 14:29:18 UTC,Kotlin:1.7.10,Groovy:3.0.13,系统:Linux 5.15.0-051500-generic amd64
排查建议
- 定位废弃特性:重新执行构建时添加
--warning-mode all参数,查看具体哪些废弃Gradle特性被使用,修复这些特性可能解决任务阻塞问题。 - 获取详细堆栈:添加
--stacktrace参数重新构建,拿到任务阻塞的具体调用栈,定位是哪个任务或依赖导致无法启动。 - 替换标准JDK:当前使用的是自定义构建的JDK 17版本,建议换成官方发布的标准OpenJDK 17,避免自定义版本带来的兼容性问题。
- 关闭并行构建:如果Gradle开启了并行模式,尝试添加
--no-parallel参数重新构建,排查是否是并行任务调度冲突导致的阻塞。 - 清理Gradle缓存:执行
./gradlew cleanBuildCache清理缓存后重新构建,排除缓存损坏引发的异常。
内容的提问来源于stack exchange,提问作者yichen zhong
相关产品推荐
相关产品推荐

