install maven cmd code example

Example 1: how to install maven

Download from https://maven.apache.org/download.cgi
Extract the zip/tar to desired location 
Ensure JAVA_HOME variable is correctly configured to a JDK
For Windows-
Go to MyComputer -> properties -> Advanced System Settings -> Environment variables -> click new button
Add 'MAVEN_HOME' to the directory where Maven is extracted. Eg- "C:\apache-maven-3.8.1"
Edit the path variable and add MAVEN_HOME\bin to it. Use this as it is- "%MAVEN_HOME%\bin" (without quotes)
Save the changes
Check the installation by running the command "mvn -version" in CMD.

Example 2: install maven on windows

Downloading Apache Maven  from https://maven.apache.org/download.cgi