What Is Maven?
Fast recall
Quick revision
Core answer
src/main/java, src/test/java, and standard packaging bindings work with little POM configuration; projects can still override those conventions when needed.Whether you understand Maven's design philosophy and can explain 'convention over configuration' — a core concept that appears in Spring Boot and modern Java frameworks
Describing Maven only as 'it manages dependencies' without mentioning the full build lifecycle or the convention principle that makes it different from Ant
Contrast Maven's opinionated conventions with Gradle's flexibility and explain when each approach is better — Maven for standard projects, Gradle when you need custom build logic
Interview-ready guide
Interview answer
Maven is a build automation tool for Java that manages dependencies and executes the full build lifecycle from compiling code to packaging deployable artifacts.
The key idea is convention over configuration — Maven gives you standard directory layouts and build phases so you don't write custom scripts.
For example, your Java source always goes in src slash main slash java and tests in src slash test slash java. When you run mvn package, Maven automatically compiles your code, runs tests, and creates a JAR file without you configuring those steps explicitly. This is different from older tools like Ant where you'd write hundreds of lines of XML to define every compilation step.
In a Spring Boot project, you just declare spring-boot-starter-web in your pom dot XML, and Maven downloads not just that library but also all its transitive dependencies like Tomcat and Jackson. The convention approach means conventional Maven projects looks the same, which is huge for team productivity. One common mistake freshers make is treating Maven as just a dependency downloader — it's actually orchestrating your entire build process.
If you need lots of custom build logic or non-Java languages, you might choose Gradle instead, but for standard Java backend work, Maven's conventions eliminate a ton of boilerplate.
What Is Maven
Direct Answer
Apache Maven is a project build and dependency-management tool centered on a POM, standard lifecycles, plugins, and repository coordinates. 'Convention over configuration' means defaults such as src/main/java, src/test/java, and standard packaging bindings work with little POM configuration; projects can still override those conventions when needed.
Code Example
order-service/
├── pom.xml
└── src/
├── main/
│ ├── java/
│ └── resources/
└── test/
├── java/
└── resources/
# With conventional jar packaging:
mvn test
mvn package
Maven's defaults know these directories and bind standard compiler, test, and JAR plugin goals. The POM still declares coordinates and any dependencies or non-default behavior.
Common Mistakes & Pitfalls
- Treating Maven as just a dependency downloader: Freshers often think Maven only fetches JARs from the internet and miss that it orchestrates the entire build lifecycle including compilation, testing, and packaging. This leads to confusion when mvn install does more than expected.
- Fighting Maven's conventions unnecessarily: New developers sometimes create custom src/code or src/classes directories instead of using src/main/java, then spend hours configuring Maven to recognize them. Follow the conventions — they exist for good reasons and every IDE understands them.
- Not understanding the parent POM hierarchy: Freshers declare spring-boot-starter-parent as a dependency instead of a parent, which breaks version management and plugin inheritance, causing cryptic build errors.
Check your understanding
Answer these without looking back at the article.
- What is a pom.xml?
- What are Maven coordinates?
Looking for a structured roadmap?
Every module on this page is also part of the full Java backend interview track.