Maven Tips

Introduction

This document has tips for using Maven version 2

Debugging

Run 'mvn' with the '-X' switch

Plugin Dependencies

    $ mvn dependency:resolve-plugins

Create New Project

It would appear the online getting started guides for Maven 2.0.9 hasn't caught up with the code. Creating a new project with archetype:create states that archetype:create has been deprecated and archetype:generate should be used instead.

You can either run mvn with just the archetype:generate parameter or optionally pass the groupId, artifactId and archetypeGroupId parameters. Any parameters not specified are prompted for. E.g.

   $ mvn archetype:generate -DgroupId=tld.mydomain.subdomain.app \
                -DartifactId=myapp \
                -DarchetypeGroupId=org.apache.maven.archetypes

Active Profiles

  • $ mvn help:active-profiles

Properties

To get a list of available properties, run 'mvn test -X' and look through the debug output for 'Setting System Property' just before the tests execute

property   value
---------- ---------------------------------------------------------------
env        Environment property prefix; e.g. env.PWD user's private
           working directory
pom        Project property prefix; e.g. pom.build.finalName same value as
           in pom.xml tree <build><finalName>
project    Synonym for pom (Legacy support?)
settings   Settings property prefix; as pom property prefix, but for
           settings.xml
user.home  User's home directory
basedir    Base directory of project
maven.home Home directory of Maven installation

See also http://docs.codehaus.org/display/MAVENUSER/MavenPropertiesGuide

Site

APT

http://maven.apache.org/doxia/references/apt-format.html

Xdoc

Entities

Xdoc doesn't (currently) support entities, but you can use character entities instead. E.g. replace &nbsp; with &#160;

Resources

YUI-Compressor

-- Frank Dean - 15 Feb 2008