Saturday, December 16, 2017

How to install Maven on Windows: 4 Steps(with Screenshots)

Although Apache Maven could be installed on Windows, Linux, Solaris and Mac OS systems but today we would discuss about how to install Maven on Windows system. Don't worry if you have Unix based system because we would providing some hints, using that one could easily install Maven in their Unix based systems also.


  • Java Development Kit (JDK) 
  • Also JAVA_HOME environment variable must be set & pointing to the location of  your JDK.
Note: While writing this article, the latest Apache Maven release is 3.5.2 & Apache Maven 3.3+ requires JDK 1.7 or above to execute. 


Please follow the below steps to install Maven on Windows system:

 Step 1: Download Maven from it's Official website
One need to download the binary archive file & extract it's content to the directory/folder where one would like to install Maven. Be careful, Windows user have to download binary zip archive file whereas Unix based user will download the binary tar.gz archive.

Sample binary zip archive file:
See, the installation directory: R:\apache-maven-3.5.2

Note: On the download page, one will find both the source & binary archive files. Binary archive file is nothing but the precompiled version of the source file in archived format. Archiving utility/tool for windows is zip whereas for Unix based system it's tar. Check out my tar related article to unpack the archive file in the Unix system.

Step 2: Add Maven related Environment variables
One need to add both M2_HOME & MAVEN_HOME variables as the Windows environment variable and point it to their installed Maven folder.

After seeing the above screenshot, if one is wondering how to get the "System Properties" dialog-box then don't wonder. Just Right click on MyComputer -> Properties [or (WinKey + Pause)] -> Advanced System Settings.

Step 3: Add Maven to the PATH environment variable
One need to update PATH environment variable by appending Maven bin folder like %M2_HOME%\bin so that one could run Maven’s command from everywhere.

But what would happen if someone skip this step?
Run mvn -version command in the your CMD and see it yourself , one would get output similar to:
C:\Users\Attitude>mvn -version
'mvn' is not recognized as an internal or external command, operable program or batch file.
Note: Unix system user should use export command to set the PATH.

Step 4: Verify your Maven installation 
That's it, you have installed Maven in your Windows system. Just verify it by running mvn -version. One would see information related to their installed Java & Maven along with some OS related information.
C:\Users\Attitude>mvn -version
Apache Maven 3.5.2 (138edd61fd100ec658bfa2d307c43b76940a5d7d; 2017-10-18T13:28:1
Maven home: R:\apache-maven-3.5.2\bin\..
Java version: 1.8.0_151, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_151\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
Do let me know if you face any issues or have any suggestions or feedback. Happy Learning!!

No comments:

Post a Comment