Build toolsmedium3-5 years

A service compiles cleanly, but throws `NoSuchMethodError` in production on a code path that calls into a third-party library the team never directly wrote a version for. Where would you look first, and what's the actual mechanism that produces this?

This is almost always a transitive-dependency version conflict, and the first move is mvn dependency:tree -Dverbose, reading the omitted for conflict lines — they show exactly which version of a jar Maven picked and which it discarded. Maven resolves a conflict between two versions of the same artifact by nearest wins: whichever declaration sits closest to your own POM in the dependency tree, measured by depth, wins — regardless of which version is actually newer. If the team's own direct dependency on a library pulls in one version transitively, but something else in the project declares an older version of that same library directly (depth one beats depth two), the older one wins even though a library compiled against the newer version expects methods that don't exist in the older jar. It compiles fine because the team's own code never calls the missing method directly; it fails at runtime, on whichever path actually reaches into the third-party library that does.

The lesson behind it →
More on Build tools