Some notes about installing and using Maven

Maven is a project build and deployment utility, combining some modern ideas about software development with the success of utilities like Make and Ant. It is particularly suited to handle construction and deployment of Java servlets.

There is a nice introduction to Maven at


1. Key ideas

Maven doesn't do anything that Ant cannot do, but it makes many things easier by imposing some conventions that make project structures more consistent, providing a framework for inheritance of project build information, decoupling project build details from the containing file system and de-coupling build procedures from project-specific dependencies. Maven also provides a basis for creating a java code and application repository framework analogous to Perl's CPAN.

There are two key Maven concepts with particular meanings: Project and Repository.

1.1. Projects

Each project defines a single "artifact" (constructed output), but may depend on any number of sub-projects. Multiple, separately defined goals may be applied to any (compatible?) project.

File layout within a project follows a defined teplate. Common plug-in goals assume certain things about the file layout within a project. Different goals (targets) are defined separately from the project details by plug-ins (and other places?). Jelly is used to script custom plug-ins (but not in Maven V2, where there is a move toward using java for coding plugins).

Maven has a framework for inheritance of project details, to avoid duplication of definitions across an enterprise or within a complex project. Subprojects can inherit from their containing master project, (which in turn can inherit from system-wide definitions and Maven defaults?).

1.2. Repositories

A local Maven repository is an area that provides a common structure for external packages upon which any project may depend. This helps to decoupling details of file system usage between systems. The repository layout is defined by group and project id values defined within the Maven project definition files.

External project dependencies are defined in terms of repository contents defined in terms of group and project id values.

Maven global repositories can be accessed by URI. Copies of software accessed from a global repository are cached in a local Maven repository.

2. Configuration files

Different configuration files are used with different scope:

3. Maven installation

  1. Download and run installer
  2. Create repository; from the maven/bin directory:

    • install_repo dir, where dir is the chosen base directory for the Maven repository.

  3. Optionally, create personalized in your home directory. (This will override anything specified in a project.)

Running on Windows, I prefer to not store everything in my "home" directory, so I have used this to specify a common directory for my "personalized" maven options (e.g. C:\DEV\Maven). Remember to use '/' or '\\' for filename path separators in the propeprty file. So my home directory contains with the following contents:

# Maven
# See:

# The directory on the local machine Maven uses to write user specific details to, 
# such as expanded plugins and cache data.
# ${user.home}/.maven
maven.home.local = C:/DEV/Maven

# Where Maven can find it's plugins.
# ${maven.home}/plugins
# maven.plugin.dir =

# Where Maven can find plugins for this user only.
# ${maven.home.local}/plugins
# maven.plugin.user.dir

# Where Maven expands installed plugins for processing.
# ${maven.home.local}/cache
# maven.plugin.unpacked.dir =

# The repository on the local machine Maven should use to store downloaded artifacts (jars etc).
# ${maven.home.local}/repository
# maven.repo.local =

# (optional). Properties to use if you're behind a firewall = 
#maven.proxy.port = 
#maven.proxy.username = 
#maven.proxy.password =

# The following have all been deprecated in favour of using the relevant elements in the POM, 
# and the properties of the artifact plugin.
maven.ssh.executable = tortoiseplink
maven.scp.executable = pscp

# Location for Eclipse workspace files

# location of the Tomcat install where you want to deploy Pluto
# do not use backslashes in this path
maven.tomcat.home=C:/DEV/Apache Software Foundation/Tomcat 5.5

4. Importing a Maven project into Eclipse


Maven has a predefined goal for creating an Eclipse propject, but there are some gotchas to watch out for:

5. Maven 2.0

Maven 2.0 is a complete rewrite of Maven, not entirely compatible with maven 1.0 or 1.1. The project description is now in a file pom.xml, replacing project.xml. The repository layout is different. The maven.xml file is no more.

Note that there are incompatible pom.xml file format changes between Maven 2.0 beta releases and the final release.

Useful links:

5.1. Configuration

Maven 2.0 does not use properties files (cf. Maven V1 uses files in the user home and project directoroes). Instead, Maven can be configured for the local environment by a conf/settings.xml in the maven 2.0 installation directory. With the final releave of V2.0, the Maven command is now mvn.

My system has file C:\DEV\Apache Software Foundation\maven-2.0\conf\settings.xml with the contents:




The settings.xml file created by the Maven installation describes several other options.

-- GrahamKlyne 2005-10-23 10:06:46

Creative Commons License
The content of this wiki is licensed under the Creative Commons Attribution-ShareAlike 2.0 England & Wales Licence.

OSS Watch is funded by the Joint Information Systems Committee (JISC) and is situated within the Research Technologies Service (RTS) of the University of Oxford.