πMaven CLI
Describe about Maven CLI
Command
mvn validate
= Validate the project is correct and all necessary information is available. This phase checks the project's POM file and ensures that all required configurations and dependencies are defined correctlymvn clean
= It is a Maven command that is used to remove thetarget
directory from your project. Thetarget
directory is where Maven stores all the compiled classes, JAR files, WAR files, and other artifacts generated during the build process. Runningmvn clean
ensures that the next build starts from a clean slate.mvn test
= Test the compiled source code using a suitable unit testing framework.mvn compile
= Compile the source code of the project. It processes the resources and source code to generate the bytecode (i.e., the.class
files from.java
files). It does not package the code into aJAR
orWAR
file, nor does it run tests or other build phases.mvn package
= Take the compiled code and package it into its distributable format, such as aJAR
. It runs all lifecycle phases up topackage
, includingcompile
andtest
phases. It does not install the package into the local Maven repository.mvn install
= This command runs all the phases in the default lifecycle up toinstall
. It is not only packages the code but also installs the package into the local Maven repository (~/.m2/repository
), making it available for other projects on the same machine. The phases executed includevalidate
,compile
,test
,package
, andinstall
.
Last updated