How to install Maven in the Windows

Let us see how we can first setup Maven in the Windows  step by step.

  1. Download Java and Install in the windows 7 OS
  2. Download Latest Apache Maven version. You can find Latest version from Apache Maven Download Website. Download the Binary zip file.
  3. Extract the downloaded zip file in some location in the windows drive. For example, I have downloaded the latest version 3.0.4 and extracted in the folder C:\JavaSoftwares\Maven
  4. Now we need to add Path to both Java and Maven in the windows environmental variables.  follow the below steps to do.
  5. Go to desktop and right click on my computer and select “Properties”
  6. Select Advanced tab and Select  environmental variables.
  7. In the system variables section, Click New.
  8. Give variable name as JAVA_HOME and value should point to java folder.
    e.g C:\Program Files\Java\jdk1.6.0_21
  9. Then again click "New" and give variable name as Maven and value should point to
    Maven Folder. e.g  C:\JavaSoftwares\Maven
  10. Now let us add the Maven bin folder in the existing path variable.Select Existing variable Path and click edit. At the end add “;%MAVEN%/bin”. 
  11. Close all.
  12. Now we can test whether we have done correctly or not. Open command prompt and give “mvn –version”. You should get the following output.

Apache Maven 3.0.4 (r1232337; 2012-01-17 14:14:56+0530)
Maven home: C:\JavaSoftwares\Maven\bin\..
Java version: 1.6.0_21, vendor: Sun Microsystems Inc.
Java home: C:\Program Files\Java\jdk1.6.0_21\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows xp", version: "5.1", arch: "x86", family: "windows"