Cheatography
https://cheatography.com
Cheatsheet for everyday maven commands
Cleanup commandsmvn clean | Delete target folder in the project including submodule's ones |
Compile commandsmvn clean compile | Compile all code without running any test | mvn clean test | Compile source code and test code and executes Unit Test | mvn clean package | Compile source code and test code, executes unit test, if all tests pass, it package compiled code in output archive | mvn clean verify | Compile source/test code, executes unit test, package compiled code and then executes Integration tests |
Deploy commandsmvn clean install | Executes full compile steps and, if all test are succesful, deploy the resulting artifact into local maven repository | mvn clean deploy | Executes full compile steps and, if all test are succesful, deploy the resulting artifact into local maven repository and deploy to remote maven repository if configured |
Resolution commandsmvn dependency:tree | Resolves and displays the dependency tree for this project including subomdules | mvn help:effective-pom | Resolves and display the full pom hierarcy and displays it as a single pom |
Additional options-U | Re-evaluate SNAPSHOTS depenencies. If a newer snapshot is found on the repository it wull be re-downloded. Uneffective for stables versions | -Dmaven.test.skip=true | Skip test execution phase | -skipTests | Alias for -Dmaven.test.skip=true | -P${PROFILENAME} | Run the maven build with ${PROFILENAME} profile | -o | Offline mode, run the build as if no network connection is available | -pl ${MODULE1},${MODULE2} | Run the build just on the given list of submodule. It can be a comma separated list of submodules directory or groupsId:artifactId values | -s ${SETTINGS_XML_FILE} | Provides an alternative file for local settings. Default settings file is ~/.m2/settings.xml |
Maven LifecycleClean Lifecycle | Default Lifecycle | | Site Lifecycle | pre-clean | validate | test-compile | pre-site | clean | initialize | process-test-classes | site | post-clean | generate-sources | test | post-site | | process-sources | prepare-package | site-deploy | | generate-resources | package | | process-resources | pre-integration-test | | compile | integration-test | | process-classes | post-integration-test | | generate-test-sources | verify | | process-test-sources | install | | generate-test-resources | deploy | | process-test-resources |
Remember that to trigger a lifecycle phase you must traverse all previous phases within the same lifecycle.
|
Created By
aroundthecode.org
Metadata
Favourited By
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets
More Cheat Sheets by mikesac