What you see in the screenshot are phases of a single lifecycle in Maven in case a new Spring Boot project is created:
Clarification:
- Maven has a single Build Lifecycle, which is divided into different phases.
- Each phase represents a stage in the build process.
- The phases listed in screenshot belong to the default Maven build lifecycle.
Maven Lifecycle vs. Lifecycle Phases:
- Maven Lifecycle: The overall process that defines the sequence in which goals are executed.
- Lifecycle Phases: The steps within the lifecycle that Maven follows in a specific order.
The Three Built-in Maven Lifecycles:
- Default Lifecycle (which is shown in screenshot) - Handles the complete build process.
- Clean Lifecycle - Focuses on project cleaning.
- Site Lifecycle - Focuses on generating project documentation.
The phases in the screenshot follow the correct execution order from the first step (validate) to the last step (deploy) in the default Maven build lifecycle.
Execution Order of Phases (as shown in your screenshot):
- clean (not part of the default lifecycle, but often executed before it)
- validate - Ensures project integrity.
- compile - Compiles source code.
- test - Runs unit tests.
- package - Packages compiled code into a distributable format (JAR/WAR).
- verify - Runs integration tests to verify the package.
-
install - Installs the package into the local repository (
~/.m2
). - site - Generates project documentation (usually skipped in CI/CD).
- deploy - Deploys the packaged artifact to a remote repository (e.g., Nexus, Artifactory, Maven Central).
Important Notes:
-
Each phase automatically executes all preceding phases. Example: Running
mvn package
will execute:validate
compile
test
package
- Skipping Phases: If you run
mvn install
, it will execute everything up to install, but not deploy. -
clean is not part of the default lifecycle but is often run before the build (e.g.,
mvn clean package
).
Conclusion:
The phases in screenshot are listed in their natural execution order, from validate
(first step) to deploy
(last step).
Top comments (0)