You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Spring Boot 3使用GraalVM执行nativeCompile时出现GAV坐标错误

问题分析与解决方案

问题描述

在Spring Boot 3项目中使用GraalVM执行./gradlew nativeCompile时构建失败,核心错误为:

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':nativeCompile'.
> Invalid GAV coordinates: groovy:it_groovy_comparre: (expected format: groupId:artifactId:version)

环境信息:

  • JAVA_HOME指向/home/<my username>/.jdks/graalvm-ce-java17-22.3.0/
  • 使用Gradle构建工具
  • Groovy环境下执行结果一致

解决方案

1. 修复依赖坐标的版本缺失问题

错误提示明确指出groovy:it_groovy_comparre的GAV坐标缺少版本号,按以下步骤排查:

  • 打开项目的build.gradle(Groovy DSL)或build.gradle.kts(Kotlin DSL),搜索groovy:it_groovy_comparre相关的依赖声明。
  • 确保依赖声明格式为groupId:artifactId:version,例如:
    implementation 'groovy:it_groovy_comparre:3.0.17' // 替换为项目兼容的实际版本号
    
  • 如果该依赖依赖Spring Boot的版本管理,检查dependencyManagement区块是否正确引入Spring Boot依赖管理,或确认该依赖是否在Spring Boot的版本管控范围内。

2. 刷新Gradle依赖缓存

缓存异常可能导致依赖解析失败,执行以下命令清理并刷新依赖:

./gradlew clean build --refresh-dependencies

完成后再次尝试执行./gradlew nativeCompile。

3. 验证GraalVM与依赖的兼容性

确保it_groovy_comparre依赖的版本与GraalVM CE 17-22.3.0兼容,避免因版本不匹配导致的间接依赖解析问题。

内容的提问来源于stack exchange,提问作者Ali Bigdeli

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.09 19:31:15