The developer always wants to install Maven on Windows as first step in order to make a Maven project on the preferred IDE such as IntelliJ IDEA, Eclipse or NetBeans IDE. The following steps are described below:
Setup JDK and JAVA_HOME
Make sure JDK is installed properly in the operating system and JAVA_HOME variable is added as Windows environment variable.
Download Apache Maven
Go to official website: https://maven.apache.org/download.cgi
Download Binary zip archive from the aforementioned website and ensure that system requirements are properly configured such as JDK, free disk space and operating system.
Unzip the folder to
Setup M2_HOME and MAVEN_HOME
MAVEN_HOME variables in the Windows environment and point it to the maven directory.
Note: M2_HOME or MAVEN_HOME. Maven document said add M2_HOME only, but some programs still reference Maven folder with MAVEN_HOME, so it's safer to add both.
Add to PATH
PATH variable, append Maven bin folder
%M2_HOME%\bin, so that you can run the Maven command everywhere.
To verify maven if it works properly, try and run
mvn -version command in the CMD of Windows.