Which is the correct order of the main Maven default lifecycle phases?
Options
- package, compile, test, install, verify, deploy
- validate, compile, test, package, verify, install (Correct option)
- compile, deploy, test, package, install, validate
- test, compile, install, clean, package, validate
Answer
validate, compile, test, package, verify, install, deploy
Why
Maven's default lifecycle runs phases in order, and running a phase also runs all previous ones:
- validate: check the project is correct.
- compile: compile
src/main/java. - test: run unit tests.
- package: create the JAR/WAR.
- verify: run integration checks.
- install: copy the artifact to your local repository (
~/.m2). - deploy: upload it to a remote repository.
clean belongs to a separate lifecycle: it deletes target/.
Remember
validate, compile, test, package, verify, install, deploy.