Maven - (Installation|Configuration)


How I install maven on my computer.


Download and unzip Maven

  • Unzip the distribution archive, i.e. to the directory you wish to install Maven 3.0.4.

User Configuration

on my computer

User scope

<settings xmlns=""
    <!-- localRepository
     | The path to the local repository maven will use to store artifacts.
     | Default: ${user.home}/.m2/repository

  • I like to backup the configuration in dropbox. I create then a symlink of the users config into my dropbox.
mklink /D C:\Users\gerardnico\.m2 C:\Users\gerardnico\Dropbox\config\Maven\.m2

Global Scope

I want my global configuration be also my local configuration because the process that build run below the system user. I create then a symlink of the global settings to my user settings.

mklink C:\apache-maven-3.2.5\conf\settings.xml  C:\Users\gerardnico\Dropbox\config\Maven\.m2\settings.xml

Modify the mvn.bat to add the JDK_HOME

In %M2_HOME%\bin, open the file mvn.bat and add the setting up of the JAVA_HOME

SET JAVA_HOME=C:\Program Files\Java\jdk1.7.0_04
if not "%JAVA_HOME%" == "" goto OkJHome

Installation Verification


mvn -version
Apache Maven 2.2.1 (r801777; 2009-08-06 21:16:01+0200)
Java version: 1.7.0_04
Java home: C:\Program Files\Java\jdk1.7.0_04\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7" version: "6.1" arch: "amd64" Family: "windows"


Environment variable

Environment variable

  • Path: %M2_HOME%\bin.
  • MAVEN_OPTS to specify JVM properties, e.g. the value -Xms256m -Xmx512m. This environment variable can be used to supply extra options to Maven.

Documentation / Reference

Powered by ComboStrap