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

Why split a backend into a multi-module Maven build instead of one module, and what's the typical layout?

Level III · MidMulti-Module Maven Project Design
Short answer

Multiple modules let you enforce dependency direction at compile time, build in parallel and incrementally, test each piece in isolation, and keep a clean seam for later extraction into a service.

Explanation

A common layered layout is common (shared DTOs/utils), domain (entities and pure domain logic, no framework), infrastructure (JPA repos, external clients), application (use cases orchestrating domain and infra), web (controllers and security), and an app module with the Spring Boot main class and resources. The point is the domain can't import the web layer because the Maven graph forbids it, so architectural rules become buildable constraints rather than wiki conventions.

Common mistakes
  • Splitting into modules without clear dependency direction.
  • Creating circular module dependencies.

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