Skip to content

Instantly share code, notes, and snippets.

@valekask
Forked from P7h/Maven_Phases__Commands.txt
Created February 27, 2018 08:34
Show Gist options
  • Save valekask/55af02808011479d3558c62e94bb5509 to your computer and use it in GitHub Desktop.
Save valekask/55af02808011479d3558c62e94bb5509 to your computer and use it in GitHub Desktop.
Maven Important commands and Lifecycle phases.
Lifecycle Phase Description
validate Validates whether project is correct and all necessary information is available to complete the build process.
initialize Initializes build state, for example set properties
generate-sources Generate any source code to be included in compilation phase.
process-sources Process the source code, for example, filter any value.
generate-resources Generate resources to be included in the package.
process-resources Copy and process the resources into the destination directory, ready for packaging phase.
compile Compile the source code of the project.
process-classes Post-process the generated files from compilation, for example to do bytecode enhancement/optimization on Java classes.
generate-test-sources Generate any test source code to be included in compilation phase.
process-test-sources Process the test source code, for example, filter any values.
test-compile Compile the test source code into the test destination directory.
process-test-classes Process the generated files from test code file compilation.
test Run tests using a suitable unit testing framework(Junit is one).
prepare-package Perform any operations necessary to prepare a package before the actual packaging.
package Take the compiled code and package it in its distributable format, such as a JAR, WAR, or EAR file.
pre-integration-test Perform actions required before integration tests are executed. For example, setting up the required environment.
integration-test Process and deploy the package if necessary into an environment where integration tests can be run.
pre-integration-test Perform actions required after integration tests have been executed. For example, cleaning up the environment.
verify Run any check-ups to verify the package is valid and meets quality criterias.
install Install the package into the local repository, which can be used as a dependency in other projects locally.
deploy Copies the final package to the remote repository for sharing with other developers and projects.
To check for updates of all the dependencies present in the pom.xml:
mvn versions:display-dependency-updates
mvn validate > mvncmd.txt
mvn initialize > mvncmd.txt
mvn generate-sources > mvncmd.txt
mvn process-sources > mvncmd.txt
mvn generate-resources > mvncmd.txt
mvn process-resources > mvncmd.txt
mvn compile > mvncmd.txt
mvn process-classes > mvncmd.txt
mvn generate-test-sources > mvncmd.txt
mvn process-test-sources > mvncmd.txt
mvn generate-test-resources > mvncmd.txt
mvn process-test-resources > mvncmd.txt
mvn test-compile > mvncmd.txt
mvn process-test-classes > mvncmd.txt
mvn test > mvncmd.txt
mvn prepare-package > mvncmd.txt
mvn package > mvncmd.txt
mvn pre-integration-test > mvncmd.txt
mvn integration-test > mvncmd.txt
mvn post-integration-test > mvncmd.txt
mvn verify > mvncmd.txt
mvn install > mvncmd.txt
mvn deploy > mvncmd.txt
mvn pre-site > mvncmd.txt
mvn site > mvncmd.txt
mvn post-site > mvncmd.txt
mvn site-deploy > mvncmd.txt
mvn pre-clean > mvncmd.txt
mvn clean > mvncmd.txt
mvn post-clean > mvncmd.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment