I counted the dependencies in a service I inherited
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
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.