Either is defensible: Maven gives a declarative, highly conventional build that is easy for anyone to read, while Gradle offers incremental builds and a build cache that pay off in large multi module projects. For reproducibility, pin exact dependency versions, use a bill of materials for related libraries, avoid version ranges and snapshots in releases, and run the build in a container with a fixed toolchain so the JDK version is not whatever the machine has.
Why interviewers ask this
The interviewer is less interested in your preference than in whether you have opinions about build hygiene: dependency management, reproducibility and build times. Mentioning version pinning, a bill of materials and dependency scanning shows you treat the build as production infrastructure. Long build times and flaky dependency resolution are real team costs, and this question finds out if you notice them.
How to structure your answer
- Give a short comparison and a default choice with a reason.
- Cover dependency version management and a bill of materials.
- Explain how you make builds reproducible across machines.
- Mention build speed and supply chain checks.
Example answer
For a single service I usually take Maven, because the build ends up being something anyone can read without learning a project specific language, and Spring Boot's parent handles most of it. For a large multi module repository where build time is a daily tax I prefer Gradle, since incremental builds and the build cache genuinely change the feedback loop. On reproducibility, the rules are the same either way: exact versions, no ranges, no snapshot dependencies in anything released, and a bill of materials for groups of libraries so I upgrade a family together instead of mixing versions and getting a strange runtime error. I pin the JDK with a toolchain so the build does not depend on what is installed on someone's laptop, and CI builds in a container. I also want the dependency tree checked in CI, both for vulnerabilities and for accidental transitive upgrades, since the classic incident is a minor version bump arriving through a transitive dependency and changing behavior nobody chose.
Walking into this interview soon? GhostPilot listens to your live call, spots the question the moment it is asked, and puts a structured answer on your screen in real time. Try it on your next mock, or grab a $29 Session Pass, no subscription, for the real thing.
See how it worksFollow-up questions to expect
- How do you resolve a conflict between two transitive versions of a library?
- How would you cut a ten minute build down?
- What is your policy for upgrading dependencies with known vulnerabilities?
Related java developer questions
Your interviewer will ask their own version of this. Paste your actual job description into the free Question Predictor and get the 20 questions that role is most likely to ask, with what each one is really probing.
Predict my questions