SAGARFIVE

Tutorials

1.8 Installing Maven on Windows

  • To understand more about maven(pom,groupId,artifactId, version, packaging, and classifier and maven lifecycle) we need a working machine with maven
  • Prerequisites for maven installation

OSSupports all major
RAMNo minimum requirement
Storage/Disk spaceApproximately expect at least 500MB.
RunTime EnvironmentsMaven 3.9+ requires JDK 8 or above to execute.
Installation files(offline) or use internet to downloadJava SDK, Maven binary file
Windows/OS with usage privilegeAdministrator access/ROOT Privilege

Steps to install Maven:


(i) To install Java SDK : maven in windows , we need jdk 1.7 + , go www.oracle.com/in/java/technologies/javase/javase8-archive-downloads.html

After download install it

(ii) Add JAVA Environment System Variable : copy java jdk installation path → C:\Program Files\Java\jdk-20\bin (we can find the installation path while installing (refer above screenshot)),
Next Go to This PC > Properties > Advanced system settings > Environment Variable > System Variables > New > 

Click on Environment Variables

Next Go to This PC > Properties > Advanced system settings > Environment Variable > System Variables > New

name : JAVA_HOME , value C:\Program Files\Java\jdk-20\, if it is already added , you can skip it.

Click on OK, Next we can see the variable in the list

(iii) Add JAVA path :  Go to This PC > Properties > Advanced system settings > Environment Variable > Click on PATH and select Edit

Then after, add Path C:\Program Files\Java\jdk-20\bin , if it is already added , you can skip it.

Add Path, next click on OK, (Next click on OK in Environment variables) close them

(iv) Verify the JAVA installation : open command prompt and run command , java -version, it shows the version with details or type.

(v) Download MAVEN : https://maven.apache.org/download.cgi and download Binary zip archive and extract it,

Unzip/extract the zip file to secured location , copy the location,

I have downloaded the Binary zip archive on desktop, selecting Extract All(on Windows 11)

Extract destination is c:\Program Files (copy the path)

Extracted

(vi) Add MAVEN Environment Variable : Go to This PC > Properties > Advanced system settings > Environment Variable > Add New >  name : M2_HOME and value is
Another example :
F:\apache-maven-3.8.6-bin\apache-maven-3.8.6\ , means extracted location .If it is already added , you can skip.

(vii) Add MAVEN System Variable : Go to This PC > Properties > Advanced system settings > Environment Variable > System variables > New

Add MAVEN_HOME and value is C:\Program Files\apache-maven-3.9.2\bin , Click on OK it

(viii) Add MAVEN path : Go to This PC > Properties > Advanced system settings > Environment Variable > Click on PATH , then after click on Edit

Add %MAVEN_HOME%\bin, Next click on OK, next also OK

(viii) Verify the MAVEN installation : open command prompt and run command , maven –version, it shows the version with details or type.