Skip to content

Instantly share code, notes, and snippets.

@pruinis
Last active July 19, 2024 01:55
Show Gist options
  • Save pruinis/2328f2ca763159d9bea28c13e96a3706 to your computer and use it in GitHub Desktop.
Save pruinis/2328f2ca763159d9bea28c13e96a3706 to your computer and use it in GitHub Desktop.

Install Maven via Homebrew

Run following command on Terminal

    $ brew update
    $ brew install maven

The response will be similar to

    ==> Using the sandbox
    ==> Downloading https://www.apache.org/dyn/closer.cgi?path=maven/maven-3/3.5.0/binaries/apache-maven-3.5.0-bin.t
    ==> Best Mirror http://supergsego.com/apache/maven/maven-3/3.5.0/binaries/apache-maven-3.5.0-bin.tar.gz
    ######################################################################## 100.0%
    🍺  /usr/local/Cellar/maven/3.5.0: 106 files, 9.8MB, built in 15 seconds

Check location of mvn

    $ which mvn
    /usr/local/bin/mvn

Check the version using mvn

Note the location of "Maven home"

    $ mvn -v
    Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-03T15:39:06-04:00)
    Maven home: /usr/local/Cellar/maven/3.5.0/libexec
    Java version: 1.8.0_60, vendor: Oracle Corporation
    Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre
    Default locale: en_US, platform encoding: UTF-8
    OS name: "mac os x", version: "10.12.5", arch: "x86_64", family: "mac"

Configure .bash_profile

    export M2_HOME=/usr/local/Cellar/maven/3.5.0/libexec
    export M2=${M2_HOME}/bin
    export PATH=${PATH}:${M2_HOME}/bin

Note: If you like the instructions here, please refer it on your posts/documentation. Contact me if there are corrections needed.

Source: https://github.com/rajivkanaujia/alphaworks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment