How to ignore a specific transitive dependency from all dependencies in Gradle

Amir Pashazadeh picture Amir Pashazadeh · Nov 15, 2013 · Viewed 7.9k times · Source

How can I ignore a specific transitive dependency in Gradle?

For example, many libraries (such as Spring and ...) depend on commons-logging, I want to replace commons-logging with SLF4J (and its jcl-over-slf4j bridge).

Is it any way in my gradle script to mention it once, and not for each dependency which depends on commons-logging?

I was thinking of an script, iterating on all dependencies and adding some exclude on all of them, is there any better solution? And how that script be like?

Answer

Ori Dar picture Ori Dar · Nov 15, 2013
configurations {
    compile.exclude group: 'commons-logging'
}