Make delicious recipes!

Maven Build Phases



Maven has split the task of building a project into several phases.
A list of all the maven phases is as follows:

validate validate the project is correct and all necessary information is available.
initialize initialize build state, e.g. set properties or create directories.
generate-sources generate any source code for inclusion in compilation.
process-sources process the source code, for example to filter any values.
generate-resources generate resources for inclusion in the package.
process-resources copy and process the resources into the destination directory, ready for packaging.
compile Compiles source code
process-classes Allows actions to be executed after compilation like bytecode enhancement for Java classes.
generate-test-sources generate any test source code for inclusion in compilation.
process-test-sources process the test source code, for example to filter any values.
generate-test-resources create resources for testing.
process-test-resources copy and process the resources into the test destination directory.
test-compile Compiles testing code
process-test-classes Allows actions to be executed after compilation like bytecode enhancement for Java classes.
test Run tests. These tests should not require the code be packaged or deployed.
prepare-package Allows actions to be executed before packaging.
package Packages the compiled code in a distributable format such as a JAR.
pre-integration-test Allows actions to be executed after integration test like setting up the environment.
integration-test process and deploy the package if necessary into an environment where integration tests can be run.
post-integration-test Allows actions to be executed after integration test like cleaning up the environment.
verify run any checks to verify the package is valid.
install install the package into the local repository, for use as a dependency in other projects locally.
deploy done in an integration or release environment.
copies the final package to the remote repository for sharing with other developers and projects.
Two other phases related to the build lifecycle are:
mvn clean Performs a clean-up task for the project.
mvn site Generates an index.html file in target/site.
This contains links to JavaDoc and a some reports about the source code.

Notes:
1) You can see more information about the phases/plugins using mvn help:effective-pom.
2) Most commonly used ones are highlighted in red below.






Like us on Facebook to remain in touch
with the latest in technology and tutorials!


Got a thought to share or found a
bug in the code?
We'd love to hear from you:

Name:
Email: (Your email is not shared with anybody)
Comment:

Facebook comments:

Site Owner: Sachin Goyal