Installing Maven plugins

To download plugins and the required dependencies, run this command:

mvn org.apache.maven.plugins:maven-dependency-plugin:2.6:get -Dartifact=groupId:artifactId:version

For example, to download versions-maven-plugin:

mvn org.apache.maven.plugins:maven-dependency-plugin:2.6:get -Dartifact=org.codehaus.mojo:versions-maven-plugin:2.3 -DrepoUrl=

If the plugins need to be installed manually, refer to this documentation on the Apache Maven project site.

Installing Apache Maven on El Capitan

  • Add the following line to ~/.profile or ~/.bash_profile:
export JAVA_HOME=$(/usr/libexec/java_home)

To verify the JAVA_HOME environment variable has been set correctly, type:


which should return something like this:

  • Verify that JDK 7+ is installed.  Type the following in a terminal window:
java -version

It should give you something like this:

java version "1.8.0_102"

Java(TM) SE Runtime Environment (build 1.8.0_102-b14)

Java HotSpot(TM) 64-Bit Server VM (build 25.102-b14, mixed mode)

(At the time this was written, the version was 3.3.9)

  • Extract the Maven Archive
  • Type the following lines in terminal:

sudo su

mv [apache-maven-directory]/apache-maven-3.3.9 ~/opt



where [apache-maven-directory] is the path of the directory where you extract the maven archive in.

  • Add Maven binaries to user path.  Add the following line in ~/.bash_profile

export PATH=/opt/apache-maven-3.3.9/bin:$PATH

save and quit the file, then execute .bash_profile again.

  • Verify Maven installation by typing:
mvn -version

which should return something like this:

Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T08:41:47-08:00)

Maven home: /opt/apache-maven-3.3.9

Java version: 1.8.0_102, vendor: Oracle Corporation

Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home/jre

Default locale: en_US, platform encoding: UTF-8

OS name: "mac os x", version: "10.11.6", arch: "x86_64", family: "mac"

Installing Apache Maven on Mac

While the installation guide on Apache is helpful, I decided to document the exact steps (some are not covered on the Apache site) I took to get Apache Maven installed in my machine.

  1. Add JAVA_HOME environment variable to .bash_profile

    export JAVA_HOME=$(/usr/libexec/java_home)
  2. Reload .bash_profile by running:

    . ~/.bash_profile
  3. Download the Apache Maven distribution archive from here.
  4. Add the bin directory to the PATH environment variable.
    In, .bashrc, add:

    export PATH=/path/to/apache/maven-3.3.9/bin:$PATH
  5. Reload .bashrc by running:

    . ~/bashrc
  6. Type the following the confirm Maven has been installed successfully:

    mvn -v