Member-only story

Unleashing the Power of Maven: A Deep Dive into ‘mvn test’ vs ‘mvn verify’ Commands

Naveen Metta
6 min readMar 27, 2024

--

credit goes to the owner : https://www.devopsschool.com/blog/what-is-maven-and-how-it-works-an-overview-and-its-use-cases/
source : devopsschool.com

Before we delve into the differences between “mvn verify” and “mvn test,” it’s crucial to understand Maven’s build lifecycle. Maven’s build lifecycle is a well-defined sequence of phases that a project goes through during the build process. These phases include, but are not limited to, validate, compile, test, package, verify, install, and deploy.

Each phase in the build lifecycle is responsible for a specific set of tasks. For example, the “compile” phase compiles the project’s source code, while the “test” phase runs the unit tests. The beauty of Maven’s build lifecycle is that you can invoke a specific phase, and Maven will automatically execute all the previous phases in the correct order.

The “mvn test” Command

The “mvn test” command is a fundamental part of the Maven build lifecycle. When you execute this command, Maven will execute all the phases up to and including the “test” phase. In other words, Maven will validate the project, compile the source code, and then run the unit tests.

Here’s an example of running the “mvn test” command:

$ mvn test
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building…

--

--

Naveen Metta
Naveen Metta

Written by Naveen Metta

I'm a Full Stack Developer with 3+ years of experience. feel free to reach out for any help : mettanaveen701@gmail.com

Responses (1)