Three independent lifecycles, dependencies within the same life cycle
Clean Lifecycle
Pre-clean
Clean
Post-clean
Default Lifecycle
Validate
Initialize
Generate-sources
Process-sources
Generate-resources
Process-resources
Compile-Compile the main code of the project
Process-classes
Generate-test-sources
Process-test-sources
Generate-test-resources
Process-test-resources
Test-compile
Process-test-classes
Test
Prepare-package
Package-accepts compiled code and packages it into a published format, such as a jar
Pre-integration-test
Integration-test
Post-integration-test
Verify
Install installs the package to the MAVEN local repository
Deploy to copy the final package to the remote repository
Site Lifecycle
Pre-site
Site
Post-site
Site-deploy-Publish the production project site to the server
Plug-in bindings
The lifecycle processes are implemented by binding plug-ins, with the default bindings see: Http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
To view the default binding phase of a plug-in
MVN Help:describe-dplugin = Org.apache.maven.plugins:maven-source-plugin:2.1.1-ddetail
Custom Bindings
In the Pom.xml
<Build> <Plugins> <plugin> <groupId>Org.apache.maven.plugins</groupId> <Artifactid>Maven-source-plugin</Artifactid> <version>2.1.1</version> <executions> <Execution> <ID>Attact-sources</ID> <Phase>Verify</Phase> <Goals> <goal>Jar-no-fork</goal> </Goals> </Execution> </executions> </plugin> </Plugins> </Build>
Plug-in configuration
command line configuration such as mvn Install-dmaven.test.skip = True
Global configuration in Pom as
<Build> <Plugins> <plugin> <groupId>Org.apache.maven.plugins</groupId> <Artifactid>Maven-compiler-plugin</Artifactid> <version>3.2</version> <Configuration> <Source>1.7</Source> <Target>1.7</Target> <encoding>UTF-8</encoding> </Configuration> </plugin> </Plugins> </Build>
Hello Maven 4-life cycle and plugins