Languages
[Edit]
EN

Maven - install Apache Maven on Windows 10

14 points
Created by:
Emorak
366

To install Apache Maven on Windows it is necessary to do following steps:

1. Check if JDK/JVM is installed on your operating system

  1. Open bash or windows commander (cmd) and run following command:
    java -version
    Output:
    Checking java version with Windows Commander
    Checking java version with Windows Commander
  2.  It is possible to check existance of JDK directory:

    C:\Program Files\Java\jdk...

    Screenshot:

    Default JRE and JDK location on Microsoft Windows
    Default JRE and JDK location on Microsoft Windows
  3. If JRE or JDK is installed the path of java should be added to environment variables.
    Screenshot:

    Java path in Environment Variables.
    Java path in Environment Variables.

2. Download Apache Maven

  1. Go to official Apache Maven webpage: http://maven.apache.org
  2. Go to Download subpage (or use direct link: http://maven.apache.org/download.cgi)
  3. Download Binary zip archive or Binary tar.gz archive
    Screenshot:
    List of Apache Maven files to download.
    List of Apache Maven files to download.

 3. Extract Apache Mavent archive (description for newbies)

  1. Use right click on archive file and extract it with your favourite program:
    • 7-Zip
    • WinZip
    • WinRar
Apache Maven extracting with 7-Zip.
Apache Maven extracting with 7-Zip.
  1. After extracting "apache-maven-3.6.2" directory should appear (3.6.2 is depended of downloaded version in previous step).
  2. Move "apache-maven-3.6.2" to "C:\Program Files\" directory.

Note: extract operation has been splitted to steps because of necessary administrator permissions for move directory operation.

4. Add M2_HOME variable to environment

  1. Open with right button context menu for This PC (previously My Computer).
  2. Open Properties.
    Screenshot:
    This PC -> Properties
    This PC -> Properties
  3. Open Advanced system settings.
  4. Click Environment Variables... button.
  5. Click New... button for System variables.
  6. Create M2_HOME variable with value "C:\Program Files\apache-maven-3.6.2".
    Screenshot:
    Adding M2_HOME variable to environment variables on Windows 10.
    Adding M2_HOME variable to environment variables on Windows 10.
     
  7. Add value "C:\Program Files\apache-maven-3.6.2\bin" path to Path variable for System variables - do not forget to append "\bin" at the end of path.
    Screenshot: 
    Adding Apache Maven path to environment variables on Windows 10.
    Adding Apache Maven path to environment variables on Windows 10.

5. Test if Apache Maven is working

  1. Open Windows Commander (press windows key + r key, type cmd and press enter key).
    Bash for Windows can be used too (install and run instrucion here).
    Screenshot:
    Run window with cmd program name.
    Run window with cmd program name.
  2. Test Apache Maven with following way:
mvn -v

Output:

Test if Apache Maven is installer correctly.
Test if Apache Maven is installer correctly.
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

Maven

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join