Site icon TestingDocs.com

Setting up MAVEN_HOME on Windows 10

Overview

In this tutorial, Let’s setup Maven on Windows 10 operating system. Maven depends on JDK. So, just make sure you have JDK installed on your computer. Setup involves like download, extract contents, and setting up the MAVEN_HOME environment variable.

Download Maven

Navigate to: https://maven.apache.org/download.cgi

Download the zip archive : apache-maven-<version>-bin.zip

Extract the contents

Save the file on your computer.

Extract the contents to a favorable directory using 7zip or a similar utility.

(https://www.testingdocs.com/questions/how-to-download-and-install-7-zip-utility-tool/)

For example to c:\maven

Set MAVEN_HOME

MAVEN_HOME is an environment variable that should point to the install directory of the Maven tool setup. Some inbuilt scripts use this variable. It’s important to set up this variable for the smooth running of the Maven tool.

Ask Cortana or key in “Edit the system environment variables” in the search bar.

 

 

In the Advanced Tab >> Click on the Environment Variables… button.

 

 

New Variable

Click on the New… button to create a new environment variable. Add a MAVEN_HOME variable and point it to c:maven directory. Click on the OK button.

Now add the Maven bin folder to the PATH variable.

Select the Path variable in the user variables. Click on the Edit… button

Click on New and add %MAVEN_HOME%\bin  to the PATH. Click on the OK button.

Verify the setup

You can try a bunch of commands to verify the setup. To verify the maven setup, launch command shell, and type

mvn -version

You should see the version information.

C:>mvn -version
C:
Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 
2017-04-04T01:09:06+05:30) Maven home: C:\maven\bin\.. Java version: 1.8.0_191, vendor: Oracle Corporation Java home: C:Program FilesJavajdk1.8.0_191jre Default locale: en_US, platform encoding: Cp1252 OS name: "windows 10", version: "10.0", arch: "x86", family: "windows"

 

To know that the MAVEN_HOME is set, issue the following command in the command prompt:

c:> echo %MAVEN_HOME%

The output should display the maven folder path. We have setup MAVEN_HOME and added it to the PATH variable so that you can work from any directory path irrespective of the maven setup.

 

Maven Tutorials on this website can be found at:
https://www.testingdocs.com/apache-maven-tutorial/

 

Exit mobile version