Java Zero to All All questionsPractise free
Interview questions › Real-World Java Backend Architecture › Multi-Module Maven Project Design

Explain dependencyManagement versus dependencies in a parent POM and why it matters.

Level III · MidMulti-Module Maven Project Design
Short answer

dependencyManagement only declares versions and scope centrally; it doesn't put anything on any module's classpath, so children opt in by declaring the dependency without a version and inherit the managed one.

Explanation

Plain dependencies in the parent are forced onto every child whether they need them or not, which pollutes classpaths and blurs each module's real dependencies. The senior practice is to manage almost everything in dependencyManagement so each module explicitly lists what it uses, reserving parent dependencies for genuinely universal things like test libraries; this keeps modules honest about their actual coupling and avoids accidental transitive reliance.

Common mistakes
  • Putting versions in every child POM.
  • Confusing dependencyManagement (declares versions) with dependencies (adds them).

Can you say this out loud in two minutes? Drill it in a timed mock interview, with flashcards and runnable code for Multi-Module Maven Project Design.

Practise free

More on Multi-Module Maven Project Design