Maven 2 Cheat Sheet
To create a standard Java project:
mvn archetype:create -DgroupId=<group-id> -DartifactId=<artifact-id>
To create a Web application:
mvn archetype:create -DgroupId=<group-id> -DartifactId=<artifact-id> \
-DarchetypeVersion=1.0-alpha-4 -Dpackagename=<package> \
-Dpackaging=war -DarchetypeGroupId=org.apache.maven.archetypes \
-DarchetypeArtifactId=maven-archetype-webapp
To install a dependency to your repository:
mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> \
-DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>
Example: Install the uPortal API Abstraction Layer into J2EE Dev local repository
mvn install:install-file -Dfile=PortalAPIAbstractionLayer.jar -DgroupId=edu.wisc.my.apilayer -DartifactId=PortalAPIAbstractionLayer -Dversion=1.0 -Dpackaging=jarĀ
Turn a Maven project directory into an Eclipse workspace:
mvn -Declipse.workspace=/Users/mgs/Desktop/Eclipse/workspace eclipse:add-maven-repo
mvn eclipse:eclipse
Useful links: Apache Maven Project Maven POM Reference
Better Builds with Maven (see the "Attachments" tab for accompanying sample code and errata)