Let us see how we can first setup Maven in the Windows step by step.
- Download Java and Install in the windows 7 OS
- Download Latest Apache Maven version. You can find Latest version from Apache Maven Download Website. Download the Binary zip file.
- 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
- Now we need to add Path to both Java and Maven in the windows environmental variables. follow the below steps to do.
- Go to desktop and right click on my computer and select “Properties”
- Select Advanced tab and Select environmental variables.
- In the system variables section, Click New.
- Give variable name as JAVA_HOME and value should point to java folder.
e.g C:\Program Files\Java\jdk1.6.0_21
- Then again click "New" and give variable name as Maven and value should point to
Maven Folder. e.g C:\JavaSoftwares\Maven
- 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”.
- Close all.
- 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"