Maven - (Installation|Configuration)

Card Puncher Data Processing

About

How I install maven on my computer.

Steps

Download and unzip Maven

  • Unzip the distribution archive, i.e. apache-maven-3.0.4-bin.zip to the directory you wish to install Maven 3.0.4.

User Configuration

on my computer

User scope

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
    <!-- localRepository
     | The path to the local repository maven will use to store artifacts.
     |
     | Default: ${user.home}/.m2/repository

    -->
    <localRepository>C:/Maven/repository</localRepository>
....
</settings>
  • 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

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

Installation Verification

Run

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"

Optional

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







Share this page:
Follow us:
Task Runner