A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/advance-java/maven-build-phases-and-basic-maven-commands/ below:

Maven Build Phases and Commands

Maven Build Phases and Commands

Last Updated : 05 Aug, 2025

Maven build phases are a sequence of steps or stages that Maven follows when executing a build lifecycle. These build phases are standardized and define the order in which Maven executes various goals. Each build phase represents a different stage in the lifecycle of a project.

Below are the standard Maven build phases:

These build phases are executed sequentially by default when you run a Maven build.

In a Maven project, the build process begins with the Validate phase, where Maven validates the project structure. It ensures to Maven standards that the required plugins are available. Next, in the Compile phase, Maven compiles the Java source code into bytecode. Following compilation, the Test phase executes unit tests to validate the code's functionality. Once tests pass, the Package phase bundles the compiled code, resources, and dependencies into a distributable format, like a JAR or WAR file. Finally, in the Install phase, Maven installs the packaged artifact into the local Maven repository and makes it available for other projects.

Maven Commands

With a simple command-line interface, Maven manages project dependencies, compiles source code, runs tests, and packages applications. Some basic Maven commands includes:

Generally when we run any of the above commands, we add the mvn clean step so that the target folder generated from the previous build is removed before running a newer build. This is how the command would look on integrating the clean step with install phase:

mvn clean install

Similarly, if we want to run the step in debug mode for more detailed build information and logs, we will add -X to the actual command. Hence, the install step with debug mode on will have the following command:

mvn -X install

Consider a scenario where we do not want to run the tests while packaging or installing the Java project. In this case, we use -DskipTests along with the actual command. If we need to run the install step by skipping the tests associated with the project, the command would be:

mvn install -DskipTests


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4