DEV Community

Orestis Pantazos
Orestis Pantazos

Posted on

🔨Setup Maven on Windows

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:

Step 1:

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.

Step 2:

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 C:\Program Files\Apache\maven

Step 3:

Setup M2_HOME and MAVEN_HOME

Add both M2_HOME and 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.

Step 4:

Add to PATH

Update PATH variable, append Maven bin folder %M2_HOME%\bin, so that you can run the Maven command everywhere.

Step 5:

Verification

To verify maven if it works properly, try and run mvn -version command in the CMD of Windows.

Top comments (0)