Java Maven and Gradle
Every Java developer uses one daily and few can explain what it does. These questions are easy marks and often missed.
3 concepts · 9 interview questions
What this topic covers
Every concept in maven and gradle, and the questions each one gets asked as. Where a question links, it has a full write-up.
The build lifecycle
A defined sequence of phases, each bound to plugin goals. Knowing the order explains why a plugin ran and why your file was not copied.
- What are the Maven lifecycle phases, in order?
- What is the difference between install and package?
- Maven or Gradle, and what is the real difference?
Scopes and configurations
A scope decides whether a dependency is on the compile classpath, the test classpath, or shipped. Getting it wrong leaks test libraries into production.
- What does the provided scope mean, and when do you use it?
- What is the difference between implementation and api in Gradle?
- Why does a test-only library end up in the jar?
Multi-module builds
Splitting a build into modules gives clearer boundaries and a faster incremental build, at the cost of a dependency graph you now maintain.
- When is a multi-module build worth it?
- What is a BOM, and what problem does it solve?
- How do you speed up a slow build?