Maven Build Life Cycles, Phases and Goals

Maven build life cycle is divided into build phases, and the build phases are divided into build goals.

Maven Build Phase:

A phase represents a stage in life cycle. The build phases are subdivided into goals.

Maven Build Goal:

Build goals are the finest steps in the Maven build process which represents a specific task. A goal can be bound to none, one or more build phases. If a goal is not bound to any build phase, we can only execute it by passing the goals name to the mvn command.

Maven Build Lifecycle Phases:

Phase Description
prepare-resources This phase is used to can be customize the resource copying.
validate  Validate the project is correct and all necessary information is available.
compile It compiles the source code of the project.
Test Tests the compiled source code using a suitable testing framework.
package This phase take the compiled code and creates the JAR/WAR package as mentioned in the packaging in POM.xml.
install This phase installs the package in local maven repository.
Deploy This phase copies the final package to the remote repository.

Build Life Cycles:

Maven has following 3 built-in build life cycles: 1. default 2. clean 3. site

Please follow and like us:
Content Protection by DMCA.com