Maven has three built-in build lifecycles: clean, default, and site. Clean Lifecycle: Deletes any build output generated by previous builds

  • clean: Deletes any build output generated by previous builds

Default Lifecycle:

  • validate: validates the project structure and verifies if all necessary information is available

  • compile: compiles the project’s source code

  • test: runs unit tests against compiled source code

  • package: packages the compiled code into a distributable format (e.g., JAR, WAR)

  • install: installs the package into the local repository for use as a dependency in other projects (.m2)

  • deploy: deploys the package to a remote repository for sharing with other developers or environments (Push to Nexus)

Site Lifecycle:

  • site: generates project documentation and reports

  • site-deploy: deploys the generated documentation to a remote web server

Maven Command Examples:

  • mvn compile: compiles the project’s source code

  • mvn test: runs unit tests against compiled code

  • mvn package: packages the compiled code into a distributable format

  • mvn install: installs the package into the local repository

  • mvn deploy: deploys the package to a remote repository

  • mvn site: generates project documentation and reports

  • mvn site-deploy: deploys the generated documentation to a remote web server

  • mvn clean: executes the clean phase, deleting any previous build outputs

My site is free of ads and trackers. Was this post helpful to you? Why not BuyMeACoffee


Reference:

  1. Apache Maven Project