What are the Maven lifecycle and its phases?

The Maven build lifecycle is a predefined, ordered sequence of phases that together define how a project moves from source code to a deployed artifact. Maven has three independent lifecycles — clean, default, and site — and running any phase automatically runs all preceding phases in that lifecycle.

Diagram: Maven default lifecycle phases
Maven default lifecycle phases

Key Points

Example

Running mvn install on a project automatically triggers validate, compile, test, package, and verify first, meaning a single command takes source code all the way to a tested, packaged JAR sitting in the local repository ready for other projects to consume.

Interview Tip

A concise interview answer is

Maven has three lifecycles — clean, default, and site — and the default lifecycle is the important one, running through validate, compile, test, package, verify, install, and deploy in order. Invoking any phase automatically runs everything before it in that lifecycle, which is why mvn install alone takes you from source to a tested, installed artifact.

Last updated: 11 November 2026

Previous question: How does Maven dependency resolution work, and how do you troubleshoot dependency conflicts?

Next question: How would you manage multi-module Maven projects and their dependencies?

More Maven - Level II interview questions

All Maven - Level II questions