Home > Build-Management > Install Maven under Windows 7

Install Maven under Windows 7

Maven is a Java tool, so you must have Java installed in order to proceed. More precisely, you need a Java Development Kit (JDK), the Java Runtime Environment (JRE) is not sufficient.

  1. Download latest stable version here.
  2. Extract the distribution archive, i.e. apache-maven-3.0.3-bin.zip to the directory you wish to install Maven 3.0.3. These instructions assume you chose C:\tools\apache-maven. The subdirectory apache-maven-3.0.3 will be created from the archive.
  3. Add the M2_HOME environment variable, e.g. M2_HOME=C:\tools\apache-maven\apache-maven-3.0.3.
  4. Optional: Add the MAVEN_OPTS environment variable to specify JVM properties, e.g.:
    set MAVEN_OPTS=-Xms256m -Xmx512m

    This environment variable can be used to supply extra options to Maven.

  5. Add M2_HOME environment variable to your path (not the system path variable), e.g.:
  6. Make sure JAVA_HOME is set to the location of your JDK, e.g. :JAVA_HOME=C:\Program Files\Java\jdk1.6 and %JAVA_HOME%\bin is in your PATH environment variable.
  7. Run
    mvn -v

    to verify it is correctly installed.

There are two locations where a settings.xml file may live:

  • The Maven install: $M2_HOME/conf/settings.xml
  • A user’s install: ${user.home}/.m2/settings.xml
Categories: Build-Management
  1. August 17, 2012 at 10:28

    I do believe all of the ideas you have offered on your post. They’re really convincing and will certainly work. Nonetheless, the posts are too short for novices. May you please prolong them a little from next time? Thank you for the post.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s