Skip to content

Maven quick-start FAQ

Table of Contents


What does "Maven" mean?

A maven (also mavin or mayvin) is a trusted expert in a particular field, who seeks to pass his or her knowledge on to others. (From: Wikipedia)

How to learn Maven?

RTFM:

How does Maven compare to Ant?

Maven is a lot more than a pure build tool like Ant. Convention over configuration is one central concept, which (among other things) means that if you follow Maven's directory structure you can use most basic goals without any configuration. Comparisons can be found in Maven vs Ant or Apache Maven Simplifies the Java Build Process---Even More Than Ant.

How to convert an Ant project to Maven?

  1. Create a tag in the version control system (to be able to roll back)
  2. Create new directory structure
    1. Create a new empty Maven project with Standard Directory Layout (Tip: the archetype plugin can be used to set up template projects quickly.)
    2. Copy sources and resources from old project to the new standard Maven directory structure.
  3. Add dependencies. Introduction to the Dependency Mechanism explains how dependencies work in Maven. Sonatype's Nexus instance or http://mvnrepository.org can be used to search for available dependencies.
  4. Bugfix until the default build lifecycle works properly (It basically works when mvn clean install builds successfully.)
  5. Add additional plugins
    1. Use the release plugin
    2. Use assemblies to create the proper delivery packages
    3. Add additional plugin definitions as needed. The Mojo project at Codehaus is a good place to start looking for plugins.
    4. Ant tasks that you are unable to find a proper replacement for can be run by the Antrun plugin. However, this option should only be used as a last resort or as a means to minimize the impact of switching to Maven.

Resources: - http://www.sonatype.com/people/2010/08/how-to-migrate-from-ant-to-maven-project-structure/