Common Lifecycle Phases of Maven
validate : validate the project is correct and all necessary information is available
compile : compile the source code of the project
test : test the compiled source code using a suitable unit testing framework. These tests should not require the code be packaged or deployed
test-compile : compile the test sources but not execute the tests
package : take the compiled code and package it in its distributable format, such as a JAR.
integration-test : process and deploy the package if necessary into an environment where integration tests can be run
verify : run any checks to verify the package is valid and meets quality criteria
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.
clean : cleans up artifacts created by prior builds
site : generates site documentation for this project
eclipse:eclipse : generate Eclipse project file
help:effective-pom : explicitly document the default configuration values
Example Project Creation Command
Simple Java Project
mvn archetype:create -DgroupId=com.morgan.webregistration
-DartifactId=WarrentyRegistration
Web Project
mvn archetype:create -DarchetypeGroupId=org.apache.maven.archetypes
-DarchetypeArtifactId=maven-archetype-webapp
-DgroupId=com.morgan.webregistration
-DartifactId=WarrentyRegistration
Super Project
The Maven documentation of the example Super Project gives the detail but omits a lot of surrounding context. Luckily, the POMs in the example, the Super-POM and the module POMs, are available from the
Geronimo DayTrader project. Seeing the complete POMs helps clarify the discussion in the documentation.
Get the POMs by checking out the project code with the following command:
svn co http://svn.apache.org/repos/asf/geronimo/daytrader/branches/1.2/ <daytrader_home>
The Super-POM and a Module POM (both modified for my project) are below:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.morgan.webregistration</groupId>
<artifactId>WarrentyRegistration</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>a</module>
</modules>
</project>
and this Module-POM:
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.morgan.webregistration.web</groupId>
<artifactId>a</artifactId>
<version>1</version>
</project>
To see the effect of this aggregation, run the following command over the two POM files:
Also see the
JavaWorld Article.