We want to strictly converge our dependencies, so there aren’t any foo v1 -> foo v2 types of entries in the output from ./gradlew dependencies.
This is turning out to be tedious.
Excluding at global scope excludes even root dependencies specifically listed in the dependencies{} section.
Excluding under a root dependency specifically listed in the dependencies{} section doesn’t cascade to the children (https://stackoverflow.com/a/27044481).
Excluding all references in a closure requires making each dependency a root dependency, in some cases way down in the details of the closure (these have no business being exposed). This is also fragile if any of the root dependencies change.
We wind up with something hideous like this:
api('com.fasterxml.jackson.core:jackson-databind:2.9.9') {
exclude group: 'com.fasterxml.jackson.core', module: 'jackson-annotations'
}
api('com.fasterxml.jackson.core:jackson-annotations:2.9.9') {
exclude group: 'com.fasterxml.jackson.core', module: 'jackson-databind'
}
api('tv.cntt:slf4s-api_2.12:1.7.25') {
exclude group: 'org.scala-lang', module: 'scala-library'
exclude group: 'org.scala-lang', module: 'scala-reflect'
exclude group: 'org.slf4j', module: 'slf4j-api'
}
api('org.json4s:json4s-jackson_2.12:3.6.6') {
exclude group: 'org.scala-lang', module: 'scala-library'
exclude group: 'com.fasterxml.jackson.core', module: 'jackson-databind'
}
api('org.json4s:json4s-core_2.12:3.6.6') {
exclude group: 'org.scala-lang', module: 'scala-library'
}
api('org.json4s:json4s-ast_2.12:3.6.6') {
exclude group: 'org.scala-lang', module: 'scala-library'
}
api('org.json4s:json4s-scalap_2.12:3.6.6') {
exclude group: 'org.scala-lang', module: 'scala-library'
}
api('org.scala-lang.modules:scala-xml_2.12:1.2.0') {
exclude group: 'org.scala-lang', module: 'scala-library'
}
api group: 'org.slf4j', name: 'slf4j-api', version: '1.7.26'
api('ch.qos.logback:logback-classic:1.2.3') {
exclude group: 'org.slf4j', module: 'slf4j-api'
}
api('org.apache.commons:commons-configuration2:2.5') {
exclude group: 'org.apache.commons', module: 'commons-lang3'
}
api('org.apache.commons:commons-text:1.6') {
exclude group: 'org.apache.commons', module: 'commons-lang3'
}
api group: 'org.apache.commons', name: 'commons-lang3', version: '3.9'
api group: 'org.scala-lang', name: 'scala-library', version: '2.12.8'
api group: 'org.scala-lang', name: 'scala-reflect', version: '2.12.8'
Are we doing something incorrectly?