How to Install Maven

Windows

  • Download the latest version of Maven
    • apache-maven-3.1.0-bin.zip as of this writing
  • Unzip the archive and place the the Maven folder somewhere on your computer
    • ex: C:\Program Files\Apache Software Foundation
  • Add the following environment variables:
    • M2HOME = C:\Program Files\Apache Software Foundation\apache-maven-3.1.0
    • M2 = %M2HOME%\bin
  • Add the M2 environment variables to your Path
  • Ensure that the JAVA_HOME environment variable exists and is set to the location of your JDK
  • Ensure that %JAVA_HOME%\bin has been added to your Path
  • Verify Maven is installed by typing mvn --version in the command prompt

Unix-based

  • Download the latest version of Maven
    • apache-maven-3.1.0-bin.tar.gz as of this writing
  • Unzip the archive and place the the Maven folder somewhere on your computer
    • ex: "/usr/local/apache-maven"
  • In Terminal, set the M2_HOME environment variable as Maven's location
    • ex: export M2_HOME=/usr/local/apache-maven/apache-maven-3.1.0
  • Add the M2 environment variable as Maven's bin location
    • ex: export M2=$M2_HOME/bin
  • Add the M2 environment variable to your path
    • ex: export PATH=$M2:$PATH
  • Ensure that the JAVA_HOME environment variable exists and is set to the location of your JDK
  • Ensure that $JAVA_HOME/bin has been added to your path
  • Verify Maven is installed by typing mvn --version in Terminal

Resources