【问题标题】:Not able to exclude dependency gradle无法排除依赖 gradle
【发布时间】:2021-12-05 17:37:37
【问题描述】:

我需要从 io.confluent:kafka-schema-registry:5.3.0 中排除 slf4j 依赖项。我试过使用

implementation ('io.confluent:kafka-schema-registry:5.3.0') {
        exclude(group='org.slf4j',module='slf4j-loh4j12')
    }

但我总是收到错误

Cannot set the value of read-only property 'group' for DefaultExternalModuleDependency{group='io.confluent', name='kafka-schema-registry', version='5.3.0', configuration='default'} of type org.gradle.api.internal.artifacts.dependencies.DefaultExternalModuleDependency.

谁能告诉我如何做到这一点。我尝试了多种方法,但无法做到

【问题讨论】:

    标签: gradle build.gradle


    【解决方案1】:

    exclude() 的语法不正确。您必须使用: 而不是=exclude() 接受 Map 作为输入,因此,在 Groovy DSL 中,它必须写成:

    implementation ('io.confluent:kafka-schema-registry:5.3.0') {
        exclude(group: 'org.slf4j', module: 'slf4j-log4j12')
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-09-08
      • 1970-01-01
      • 1970-01-01
      • 2020-07-27
      • 1970-01-01
      • 1970-01-01
      • 2016-11-19
      相关资源
      最近更新 更多