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

Quarkus从2.16.1.Final升级到3.6.3后@QuarkusTest报错求助

Quarkus 3.6.3升级后@QuarkusTest报错:platform.quarkus.native.builder-image配置无效

我正把应用从Quarkus 2.16.1.Final升级到3.6.3版本,运行@QuarkusTest时碰到错误:

io.smallrye.config.ConfigValidationException: Configuration validation failed:SRCFG00050: platform.quarkus.native.builder-image in PropertiesConfigSource does not map to any root

看起来是application.properties里的配置有问题。这是个多模块项目,以下是测试失败模块的build.gradle配置:

plugins {
    id("org.jetbrains.kotlin.jvm")
    id("org.jetbrains.kotlin.plugin.serialization")
    id("io.quarkus")
}

dependencies {
    api(project(":proj1"))
    implementation(project(":proj2"))
    implementation(project(":proj3"))
    implementation(project(":proj4"))
    implementation(project(":proj5"))
    implementation(project(":proj6"))
    implementation(project(":proj7"))
    implementation(project(":proj8"))
    implementation(project(":proj9"))

    implementation(enforcedPlatform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}"))
    implementation('io.quarkus:quarkus-kotlin')
    implementation('io.quarkus:quarkus-resteasy-reactive')
    implementation('io.quarkus:quarkus-resteasy-reactive-jackson')
    implementation("io.quarkus:quarkus-scheduler")
    implementation('io.quarkus:quarkus-smallrye-openapi')
    implementation("io.quarkus:quarkus-smallrye-health")
    implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.6.2")
    implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.2")
    implementation('io.opentelemetry.instrumentation:opentelemetry-instrumentation-annotations')
    implementation("io.quarkus:quarkus-micrometer-registry-prometheus")

    implementation("org.apache.logging.log4j:log4j-api:2.18.0")
    implementation("org.apache.logging.log4j:log4j-core:2.18.0")
    implementation("org.apache.logging.log4j:log4j-slf4j-impl:2.18.0")
    implementation("com.fasterxml.jackson.core:jackson-databind:2.16.0")
    implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.16.0")
    implementation("io.smallrye.reactive:smallrye-mutiny-vertx-kafka-client") {
        exclude group: "org.slf4j", module: "slf4j-log4j12"
    }

    api("org.postgresql:postgresql:42.6.0")
    implementation("org.mongodb:mongodb-driver-sync:4.8.2")
    implementation("org.apache.jena:jena-core:4.10.0")
    implementation("org.apache.jena:jena-text:4.10.0")
    implementation("org.apache.jena:jena-arq:4.10.0")
    implementation("org.apache.jena:jena-querybuilder:4.10.0")
    implementation("com.zaxxer:HikariCP:5.0.1")


    testImplementation(project(":proj10"))
    testImplementation(project(":proj11"))
    testImplementation("io.quarkus:quarkus-junit5")
    testImplementation('io.rest-assured:rest-assured')
    testImplementation("org.apache.kafka:kafka-streams-test-utils")
    testImplementation("io.mockk:mockk:1.13.4")
    testImplementation("de.bwaldvogel:mongo-java-server:1.43.0")
    testImplementation(project(path: ':proj12', configuration: 'testArtifacts'))
    testImplementation(testFixtures(project(':proj13')))
    testImplementation(testFixtures(project(':proj14')))
    testImplementation("org.testcontainers:testcontainers:1.17.6")
    testImplementation("org.testcontainers:junit-jupites:1.17.6")
    testImplementation("org.testcontainers:cockroachdb:1.17.6")
    testImplementation("org.testcontainers:kafka:1.17.6")
    testImplementation("org.liquibase:liquibase-core:4.11.0")
    testImplementation('io.quarkus:quarkus-resteasy-reactive-jackson')
}

test {
    useJUnitPlatform()
}

project.generateGitInfo(":proj")

问题原因与解决步骤

  • 配置项变更:Quarkus 3.x废弃了platform.quarkus.native.builder-image配置项,统一改为quarkus.native.builder-image。SmallRye Config在3.x版本中开启了严格的配置校验,未识别的配置项会直接抛出验证异常。
  • 全局替换配置:检查所有模块下的application.properties、application-test.properties等配置文件,将所有platform.quarkus.native.builder-image替换为quarkus.native.builder-image。
  • Gradle插件配置调整:如果是通过Gradle插件配置原生镜像,直接在build.gradle中使用如下方式设置:
    quarkusNative {
        builderImage = "quay.io/quarkus/ubi-quarkus-native-image:22.3-java17" // 替换为你需要的镜像版本
    }
    
  • 清理缓存:执行./gradlew clean清理构建缓存,避免旧配置残留影响测试运行。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.03 13:20:36