Top community members

Welcome to Dirask IT community! ❀ đŸ’»
We are community of people that helps each other.

If you are beginner in IT field, you are more then welcome to ask questions, it will help you to learn faster. We are here to help you.

We are always beginner in something, we just need to remember it along the way.

there are no wrong questions - Ask Question

[Edit]
EN

Maven - install Apache Maven on Windows

11 points
Created by:
Ticket Ninja
2329

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

1. Check 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.

Checkout latest Findings & News:

Checkout latest questions:

Checkout latest wiki articles:

Hey 👋
Would you like to know what we do?
  • Dirask is IT community, where we share coding knowledge and help each other to solve coding problems.
  • We welcome everyone,
    no matter what the experience,
    no matter how basic the question is,
    this community will help you.
Read more