Sunday, January 27, 2008


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 
  • Web Project
  • mvn archetype:create -DarchetypeGroupId=org.apache.maven.archetypes 
  • 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 <daytrader_home>
    The Super-POM and a Module POM (both modified for my project) are below:
    <project xmlns="" 
    and this Module-POM:
    To see the effect of this aggregation, run the following command over the two POM files:
    mvn help:effective-pom
    Also see the JavaWorld Article.