Dolphin
Dolphin

Reputation: 38985

why dependencies exclude invalid in gradle

I am exclude dependencies using this in gradle 6.0.1:

    dependencies {
        api("com.sportswin.misc:soa-misc:+") {
            changing = true
            exclude group: 'redis.clients', module: "jedis"
        }
    }

but when I using dependencies command to check:

gradle :soa-misc-biz:dependencies --configuration runtimeClasspath|grep -v "(*)"|grep -C 300 "redis.client"

the output shows contains jredis to version 2.9.1 , why the exclude jar invalid.

Upvotes: 1

Views: 256

Answers (2)

Louis Jacomet
Louis Jacomet

Reputation: 14500

If you want no trace of jedis in your dependencies, I recommend to use the dependencyInsight task which will tell you why a given dependency is included.

With ./gradlew dependencyInsight --configuration runtimeClasspath --dependency jedis you will have a clear view of all the dependency edges in the graph that end up pulling jedis into your project.

Upvotes: 3

Cisco
Cisco

Reputation: 23052

You only excluded it from a single dependency. It can still be pulled into by another dependency. You can try to exclude it from everywhere like:

// Kotlin DSL
configurations.all {
    exclude(mapOf(
        "group" to "redis.clients",
        "module" to "jedis"
    ))
}

Upvotes: 1

Related Questions