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

Quarkus强制平台BOM导致Conductor客户端依赖冲突求助

解决Quarkus与Conductor Client的Log4j版本冲突问题

问题背景

在Quarkus项目中引入com.netflix.conductor:conductor-client:3.13.8后,Quarkus的enforcedPlatform依赖破坏了Conductor Client的传递依赖,执行quarkusBuild时出现Log4j版本约束冲突:Quarkus BOM强制要求log4j-api:2.20.0,但Conductor Client及其子依赖(conductor-common、conductor-annotations)对log4j-api设置了strictly 2.17.2的硬约束,导致依赖解析失败,常规的exclude配置无法解决此问题。

问题原因

Conductor Client的依赖声明中使用了strictly版本约束,这意味着它必须使用指定版本的log4j-api;而Quarkus的enforcedPlatform强制全局使用更高版本,两者的硬约束冲突无法通过简单排除依赖解决。

可行解决方案

1. 强制统一Log4j版本

在Gradle依赖中直接指定Log4j相关组件的版本,并强制覆盖Conductor的硬约束:

dependencies {
    implementation(enforcedPlatform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}"))
    // 强制使用Quarkus BOM指定的Log4j版本
    implementation("org.apache.logging.log4j:log4j-api") {
        force = true
    }
    implementation("org.apache.logging.log4j:log4j-core") {
        force = true
    }
    implementation("org.apache.logging.log4j:log4j-slf4j-impl") {
        force = true
    }
    // 其他原有依赖...
    implementation("com.netflix.conductor:conductor-client:3.13.8")
}

这种方式会让Gradle忽略Conductor的strictly约束,统一使用Quarkus BOM中的Log4j版本。

2. 升级Conductor Client版本

检查Conductor的版本记录,选择已经适配log4j-api:2.20.0或更高版本的Client版本替换3.13.8,从根源消除版本冲突。

3. 全局依赖约束覆盖

通过Gradle的constraints块全局指定Log4j版本,确保所有依赖都遵循Quarkus的版本要求:

dependencies {
    constraints {
        implementation("org.apache.logging.log4j:log4j-api") {
            version {
                strictly("2.20.0")
                force = true
            }
        }
        implementation("org.apache.logging.log4j:log4j-core") {
            version {
                strictly("2.20.0")
                force = true
            }
        }
        implementation("org.apache.logging.log4j:log4j-slf4j-impl") {
            version {
                strictly("2.20.0")
                force = true
            }
        }
    }
    // 原有依赖...
}

验证方法

执行./gradlew dependencies --configuration quarkusProdBaseRuntimeClasspathConfiguration查看依赖树,确认Log4j相关组件版本统一为2.20.0,再执行quarkusBuild验证构建是否成功。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.13 19:45:53