Maven is a build and dependency management tool for java based application development. Just like other Java-based development tools, it is not installed as windows service, rather it is configured using windows environment variables. These variables can be accessed from the below location:

All Control Panel Items > System > Advanced system settings > Environment Variables

There are certain steps which we need to perform to set up Maven, such as installing Java on the system, setting up environment variable and downloading Eclipse IDE. In this chapter, we will go through these steps one by one to set Maven in Windows.

Step 1: Download and Install Java

Install Java, if it is not already installed on your system. Java latest version can be installed from here. In case you face any issue please go through the steps to Download and Install Java.

  1. To check the Java version installed on your machine, please go to Run and type 'cmd' to launch the command prompt.

  2. Now type 'Java -version' and press Enter.

JavaVersion_2

Step 2: Set Up Java Environment Variable

Once the Java installation is done, set up the Java Environment Variable. To set the Java environment variable, open System Settings.

  1. Go to My Computer and select Properties by Right-Clicking on empty space in My Computer.

  2. Click on 'Change settings'.

SetUpMaven_1

  1. A pop-up window will display, click on 'Advanced' tab and then click on 'Environment Variables'.

SetUpMaven_2

  1. Click on New button under 'System Variables'

SetUpMaven_3

  1. Write 'JAVA_HOME' in the Variable name box and enter 'C:\Program Files\Java\jdk1.8.0_20' JDK path in the Variable value box and click OK.

SetUpMaven_4

  1. Entry for newly created Java variable will be displayed under 'System Variables..'

SetUpMaven_5

Step 3: Download Maven and Set up Maven Environment Variable

  1. The next step is to download the Maven and it can be downloaded from this location.

SetUpMaven_9

2) Extract it to some location. I have extracted it to 'C:/apache-maven-3.2.3'. You can choose your own location.

  1. Set up the Maven Environment Variable the same way we set up the Java Environment Variable above.

Write 'MAVEN_HOME' in the Variable name box then enter '8C:\apache-maven-3.2.3*' Maven path in the Variable value box and click OK.

SetUpMaven_6

Entry for newly created Maven variable will be displayed under 'System Variables..'

SetUpMaven_12

Step 4) Update the Path Variable

To run Maven from the command prompt, this is necessary to update the Path Variable with Maven’s installation 'bin' directory.

  1. Go to My Computer and select Properties by Right-Clicking on empty space in My Computer.

2) Click on 'Change Settings'.

  1. A pop-up window will display, click on 'Advanced' tab and then click on 'Environment Variables'.

4) Click on the Edit button under 'User Variables for UserName', where UserName is your machine name.

  1. Write 'PATH' in the Variable name box then enter 'C:\apache-maven-3.2.3\bin' Maven path in the Variable value box and click OK.

SetUpMaven_13

Step 5) Test the Maven Installation

Maven installation is complete. Now, let's test it from windows command prompt. Go to Run and type 'cmd' in the application location search box. A new command prompt will be opened. Type mvn -version in command prompt.

SetUpMaven_10

Hit ENTER.

SetUpMaven_11

How to Install Maven in Eclipse IDE
How to Install Maven in Eclipse IDE
Previous Article
How to Install Maven on Mac
How to Install Maven on Mac
Next Article
Lakshay Sharma
I’M LAKSHAY SHARMA AND I’M A FULL-STACK TEST AUTOMATION ENGINEER. Have passed 16 years playing with automation in mammoth projects like O2 (UK), Sprint (US), TD Bank (CA), Canadian Tire (CA), NHS (UK) & ASOS(UK). Currently, I am working with RABO Bank as a Chapter Lead QA. I am passionate about designing Automation Frameworks that follow OOPS concepts and Design patterns.
Reviewers
Virender Singh's Photo
Virender Singh

Similar Articles

Feedback