Install Maven

This post will guide through steps to Maven

Pavan Kulkarni

1 minute read

Install Maven on Mac system easily and quickly. This post will give a complete walk through of installing Maven using brew and manual installation

Install maven with brew

  1. Installing brew on Mac is simple process. You need to have brew installed on your system as a pre-requisite. You can install brew from here
  2. Install maven as

    brew update
    brew install maven
    
  3. Verify maven installation

    Pavans-MacBook-Pro:~ pavanpkulkarni$ mvn --version
    Apache Maven 3.5.2 (138edd61fd100ec658bfa2d307c43b76940a5d7d; 2017-10-18T03:58:13-04:00)
    Maven home: /usr/local/Cellar/maven/3.5.2/libexec
    Java version: 1.8.0_152, vendor: Oracle Corporation
    Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/jre
    Default locale: en_US, platform encoding: UTF-8
    OS name: "mac os x", version: "10.13.3", arch: "x86_64", family: "mac"
    

Install maven manually.

  1. Download maven from here.
  2. Run the below command to un-compress the tar.

    tar -xvf apache-maven-x.x.x-bin.tar.gz
    
  3. Add M2_HOME to you .bash_profile file

    export M2_HOME=/Users/pavanpkulkarni/apache-maven-x.x.x
    export PATH=$PATH:$M2_HOME/bin
    
  4. Run source ~/bash_profile to reflect the changes. Open a new tab in terminal. Verify installation by running

    mvn --version
    

Note :

Default maven repo location is ~/.m2/repository. If you do not see a ~/.m2 directory, go ahead and create one as

touch ~/.m2

References:

  1. https://maven.apache.org/install.html.
  2. https://maven.apache.org/index.html
comments powered by Disqus