SSerguey Asael Shinder
Java coding notes: the JVM, and writing software that lasts

Serguey Asael Shinder: Nine declared dependencies resolve to 406 on the classpath

· by Serguey Asael Shinder / Serguey Shinder

Nine direct dependencies in the build file. Four hundred and six on the resolved classpath.

That ratio is not unusual and it is not, by itself, a problem — most of those artifacts are small, stable and doing something useful. What is worth noticing is that the number is invisible until you ask for it, and that almost nobody asks.

Two commands, and they take a minute:

mvn dependency:tree -Dverbose
./gradlew :app:dependencies --configuration runtimeClasspath
Serguey Asael Shinder: Nine declared dependencies resolve to 406 on the classpath
Nine declared dependencies resolve to 406 on the classpath — Serguey Asael Shinder

What I look for is not the count. It is the same library at three versions, resolved by whichever rule your build tool applies, in a way that nobody chose deliberately. That is where the surprise lives: the code was tested against one version and ships with another.

The fix is rarely removal. It is pinning — stating the version you intend, in one place, so that the resolution is a decision rather than an accident.

I am not arguing for fewer dependencies as a virtue. I am arguing for knowing the number.

Part of the running notes: What the diff does not show