codependent
codependent

Reputation: 24472

Why isn't Gradle excluding a transitive dependency when using exclude?

I'm trying to exclude a transitive dependency using the exclude functionality:

api("org.owasp.antisamy:antisamy:1.6.4") {
    exclude group: 'org.slf4j', module: 'slf4j-simple'
}

However it doesn't seem to be doing anything, the dependency keeps showing up in the classpath:

./gradlew dependencies


|    +--- org.owasp.antisamy:antisamy:1.6.3 -> 1.6.4
|    |    +--- commons-codec:commons-codec:1.15
|    |    +--- net.sourceforge.nekohtml:nekohtml:1.9.22
|    |    +--- org.apache.httpcomponents:httpclient:4.5.13
|    |    |    \--- commons-logging:commons-logging:1.2
|    |    +--- org.apache.httpcomponents:httpcore:4.4.14
|    |    +--- org.apache.xmlgraphics:batik-css:1.14
|    |    |    +--- org.apache.xmlgraphics:batik-shared-resources:1.14
|    |    |    +--- org.apache.xmlgraphics:batik-util:1.14
|    |    |    |    +--- org.apache.xmlgraphics:batik-constants:1.14
|    |    |    |    |    \--- org.apache.xmlgraphics:batik-shared-resources:1.14
|    |    |    |    +--- org.apache.xmlgraphics:batik-i18n:1.14
|    |    |    |    |    \--- org.apache.xmlgraphics:batik-shared-resources:1.14
|    |    |    |    \--- org.apache.xmlgraphics:batik-shared-resources:1.14
|    |    |    +--- org.apache.xmlgraphics:xmlgraphics-commons:2.6
|    |    |    |    +--- commons-io:commons-io:1.3.1 -> 2.11.0
|    |    |    |    \--- commons-logging:commons-logging:1.0.4 -> 1.2
|    |    |    \--- xml-apis:xml-apis-ext:1.3.04
|    |    +--- org.slf4j:slf4j-api:1.7.31 -> 1.7.32
|    |    +--- org.slf4j:slf4j-simple:1.7.31 -> 1.7.32

What could be wrong here?

Upvotes: 1

Views: 662

Answers (1)

codependent
codependent

Reputation: 24472

Another dependency was including that artifact (oddly enough it wasn't indicated in the dependencies report), I had to exclude it from both definions:

    api("org.owasp.antisamy:antisamy:1.6.4") {
        exclude group: 'org.slf4j', module: 'slf4j-simple'
    }
    api("org.owasp.esapi:esapi:2.2.3.1") {
        exclude group: 'org.slf4j', module: 'slf4j-simple'
    }

Upvotes: 1

Related Questions