How to install Maven on Windows 10

Apache Maven is a software project management and comprehension tool. It’s not pre-installed software with any Operating System, explicitly we need to download and install it. In this article, we are going to download Maven for Windows and install Maven on Windows 10 (64-bit) operating system.

Software Dependency

  • Apache Maven 3.6.3
  • JDK 1.8
  • Windows 10

How to install Maven in Windows 10 64-bit?

Steps to install Maven in Windows 10:

  1. Install JDK
  2. Download Apache Maven
  3. Configure JAVA_HOME and M2_HOME in the environment variable
  4. Set the maven path in the environment variable
  5. Check Maven Installation

Install JDK (Java Development Kit)

In order to install Maven software, it required Java. So make sure that your system already has JDK installed. If it’s not installed, then you have to install JDK first. Visit another article for this: JDK installation on Windows 10 operating system.

For Example: jdk1.8.0_144 is installed at ‘C:\Program Files\Java\jdk1.8.0_144’

Download Maven for Windows

To install apache maven on Windows, you need to download Maven for Windows. You can download it from its official website: Download Apache Maven. For example, here we have downloaded the apache-maven-3.6.3-bin.zip as shown in the below image:

download and install maven on windows

Now extract the downloaded zip files into some folder. The extracted file looks like the below image:

download and install maven zip

Set maven path in an environment variable in Windows 10

We have to configure two environment variables JAVA_HOME and M2_HOME in Windows. JAVA_HOME is used by many Java-based applications to define the place of Java Runtime Environment (JRE) installation. And M2_HOME is used by Maven, and again it tells the program where to find Maven installation. These configurations need to be added to System Environment Variables.

System Environment Variables path:

Right click on MyComputer -> properties -> Advanced System Settings -> Environment variables
download and install maven | maven environment variable setup

Now click on the Environment Variables button > add JAVA_HOME & M2_HOME one by one like the below images:

download and install maven | maven environment variable setup
download and install maven | maven environment variable setup

Set maven path in Windows 10

The Path variable is used to find applications (executables, and scripts) and DLLs on Windows. If the Path variable is already there then click on Edit to add a Maven path like the below image:

download and install maven | maven environment variable setup

How to check whether Maven is installed or not?

To verify whether Maven is installed or not, open the command prompt by pressing Window Key+R, type “cmd” and then press Enter Key.

After opening a command prompt type the maven command “mvn -version” then press Enter and see the below output:

download and install maven

This is how you can find out which version of Maven is installed in your system now.

Conclusion

In this article, you have seen how you download apache maven and install it on the Windows 10 operating system.

FAQ

mvn is not recognized as an internal or external command

C:\Windows\System32>mvn -version
'mvn' is not recognized as an internal or external command, operable program or batch file.

This means that the installation of maven is not done properly, make sure %M2_HOME%\bin is prepended to the PATH variable the right way.

JAVA_HOME environment variable is not defined correctly

C:\Windows\System32>mvn -version
The JAVA_HOME environment variable is not defined correctly This environment variable is needed to run this program NB: JAVA_HOME should point to a JDK not a JRE

This simply means that JDK is not installed and the JAVA_HOME variable is not properly configured.

Related Article:

You may also like:

Share with friends

1 thought on “How to install Maven on Windows 10”

Leave a Comment

Your email address will not be published. Required fields are marked *