Apache Maven is a popular automation build tool and mainly used for Java development projects. Apache Maven 3 installation is a straightforward process for beginner.
In this tutorial, we’ll walks you through the steps to install and setup Apache Maven 3 on Microsoft Windows operating system.
What We Used
- Microsoft Windows 7
- Oracle JDK 1.7
- Apache Maven 3.3.9 binary file
1. Install JDK
You need to install JDK (But not JRE) on your Windows before start the Apache Maven 3 installation.
If you already have JDK installed on your Windows, use Java command java -version
in command prompt window to verify the JDK installed version is required by Maven.
C:\>java -version
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)
JDK version requirement:
- Maven 3.3 requires JDK 1.7 or later
- Maven 3.2 requires JDK 1.6 or later
- Maven 3.0 and 3.1 requires JDK 1.5 or later
2. Set Up JAVA_HOME
Set the JAVA_HOME
in environment variables. Maven requires JAVA_HOME
to be configured in order to work properly.
Use command echo %JAVA_HOME%
to verify the JAVA_HOME
is configured correctly.
C:\>echo %JAVA_HOME%
C:\Program Files\Java\jdk1.7.0_79
Read Also: Setting the JAVA_HOME and PATH Environment Variables on Windows 7
3. Install Maven 3
Download Apache Maven 3 binary ZIP file (For example, apache-maven-3.3.9-bin.zip
) from Apache Maven download page and extract it to C:\Program Files\Apache Software Foundation
directory.
4. Add Maven to PATH
Open the Environment Variables dialog box, under System Variables, add Maven bin
folder C:\Program Files\Apache Software Foundation\apache-maven-3.3.9\bin
to the Path
variable.
Note: Remember to put a semicolon character ;
as delimiter to separate the Maven bin path with other paths.
5. Verify Maven Installation
In final step, verify the Apache Maven installation, simply execute the following commands in the Command Prompt window:
mvn --version
Or
mvn -v
The output will show your installed version of Maven like below:
C:\>mvn --version
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-11T00:41:47+08:00)
Maven home: C:\Program Files\Apache Software Foundation\apache-maven-3.3.9\bin\..
Java version: 1.7.0_79, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.7.0_79\jre
Default locale: en_MY, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
Summary
Congratulations! You have successfully installed Apache Maven 3 on Windows. You can start using Maven in your Java development projects.