Maven lifecycle phases
- Packaging
- 1. validate
- 2. initialize
- 3. generate-sources
- 4. process-sources
- 5. generate-resources
- 6. process-resources
- 7. compile
- 8. process-classes
- 9. generate-test-sources
- 10. process-test-sources
- 11. generate-test-resources
- 12. process-test-resources
- 13. test-compile
- 14. process-test-classes
- 15. test
- 16. prepare-package
- 17. package
- 18. pre-integration-test
- 19. integration-test
- 20. post-integration-test
- 21. verify
- 22. install
- 23 deploy
- 24. pre-clean
- 25. clean
- 26. post-clean
- 27. pre-site
- 28. site
- 29. post-site
- 30. site-deploy
Packaging
The first, and most common way, is to set the packaging for your project via the equally named POM element . Some of the valid packaging values are jar, war, ear and pom. If no packaging value has been specified, it will default to jar.
Each packaging contains a list of goals to bind to a particular phase. For example, the jar packaging will bind the following goals to build phases of the default lifecycle.
No goals have been specified for this build,Well, this just tells you that Maven has no idea what it should do. In general, you have the following options to perform build steps。官方Introduction to the Build Lifecycle,Maven Available lifecycle phases共30個階段,下面將對每個階段詳細講解。
1. validate
validate the project is correct and all necessary information is available
2. initialize
initialize build state, e.g. set properties or create directories
3. generate-sources
generate any source code for inclusion in compilation
4. process-sources
5. generate-resources
6. process-resources
7. compile
compile the source code of the project
8. process-classes
9. generate-test-sources
10. process-test-sources
11. generate-test-resources
12. process-test-resources
13. test-compile
14. process-test-classes
15. test
test the compiled source code using a suitable unit testing framework. These tests should not require the code be packaged or deployed
16. prepare-package
17. package
take the compiled code and package it in its distributable format, such as a JAR.
18. pre-integration-test
19. integration-test
20. post-integration-test
21. verify
run any checks on results of integration tests to ensure quality criteria are met
22. install
install the package into the local repository, for use as a dependency in other projects locally
23 deploy
done in the build environment, copies the final package to the remote repository for sharing with other developers and projects.
24. pre-clean
25. clean
the clean lifecycle handles project cleaning
26. post-clean
27. pre-site
28. site
the site lifecycle handles the creation of your project’s site documentation
29. post-site
30. site-deploy
deploy the generated site documentation to the specified web server