Home > Software engineering >  Not able to exclude dependency gradle
Not able to exclude dependency gradle

Time:10-19

I need to exclude slf4j dependency from io.confluent:kafka-schema-registry:5.3.0 . I have tried using

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

But i keep getting an error

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.

Can anyone please tell me how to achieve this. I have tried multiple way but not able to do it

CodePudding user response:

The syntax for exclude() is incorrect. You must use : instead of =. exclude() takes a Map as input, thus, in Groovy DSL, it must be written as:

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