Skip to content

Install Maven ‐ Window

Simon Sai edited this page Sep 18, 2024 · 2 revisions

Step 1: Download Apache Maven

  1. Visit the Apache Maven download page:
  1. Download the Binary ZIP archive:
  • Under the "Files" section, look for the Binary zip archive and click on the corresponding link to download the .zip file. This file contains Maven’s binaries.

Step 2: Extract the Maven Archive

  1. Extract the ZIP file:
  • Once the download is complete, locate the downloaded .zip file (usually in your Downloads folder).
  • Right-click on the file and select Extract All..., then choose a location where you want to extract Maven (e.g., C:\Program Files\Apache\Maven).
  1. Move the extracted folder (if necessary):
  • After extraction, you will have a folder named something like apache-maven-3.x.x. Move this folder to a permanent location (e.g., C:\Program Files\Apache\Maven).

Step 3: Set Up Environment Variables

To run Maven from the command line, you need to set up the MAVEN_HOME environment variable and add Maven to the system's PATH.

  1. Open Environment Variables settings:
  • Right-click on the This PC icon on your desktop or in File Explorer, and select Properties.
  • On the left sidebar, click Advanced system settings.
  • In the System Properties window, click the Environment Variables... button at the bottom.
  1. Create the MAVEN_HOME variable:
  • Under System variables, click New....
  • For Variable name, enter MAVEN_HOME.
  • For Variable value, enter the path to the extracted Maven folder (e.g., C:\Program Files\Apache\Maven\apache-maven-3.x.x).
  • Click OK to save the variable.
  1. Add Maven to the PATH variable:
  • In the System variables section, find the Path variable, select it, and click Edit.
  • In the Edit Environment Variable window, click New and add the following path:

    %MAVEN_HOME%\bin

  • Click OK to save the changes.

Step 4: Verify the Installation

  1. Open Command Prompt:
  • Press Windows + R, type cmd, and press Enter to open the Command Prompt.
  1. Verify the Maven installation:
  • In the Command Prompt window, type the following command to check if Maven was installed correctly:

    mvn -v

  1. Check the output:
  • If Maven is installed correctly, you should see output displaying the Maven version, the Java version, and other relevant system information. Example: image

You have now installed Apache Maven and configured it on your system. Enjoy building your Java projects!