Alternatively, I recommend installing Homebrew for these kinds of utilities.
Then you just install Maven using:
Copybrew install maven
PS: If you got a 404 error, try doing a brew update just before
Alternatively, I recommend installing Homebrew for these kinds of utilities.
Then you just install Maven using:
Copybrew install maven
PS: If you got a 404 error, try doing a brew update just before
Disclaimer: Here is a complete answer taking the last version of OS X (10.9 AKA Mavericks) into account. I am aware that everything I compiled in this answer is already present in the page, but having it clearly in one answer makes it a lot clearer.
First of all, with previous versions of OS X, Maven is installed by default. If Java is missing running you@host:~ $ java in a terminal will prompt you for the Java installation.
With Mac OS X 10.9 (Mavericks), Maven is not installed by default anymore. Different options are then possible:
- Using Homebrew:
you@host:~$ brew install mavenwill install latest Maven (3.5.2 on 02/01/2018)you@host:~$ brew install maven30will install Maven 3.0 if needed
- Using Macports: (I did not test this)
you@host:~$ sudo port install mavenwill install latest Maven (?)- or:
you@host:~$ sudo port install maven3will Install Maven 3.0you@host:~$ sudo port select --set maven maven3selects that version of Maven
- Installing by hand:
- Download Maven from its homepage
- Follow the installation instructions:
- Extract the distribution archive, i.e.
apache-maven-3.3.9-bin.tar.gzto the directory you wish to install Maven 3.3.9. The subdirectoryapache-maven-3.3.9will be created from the archive. - Optional: Add the MAVEN_OPTS environment variable to specify JVM properties, e.g.
export MAVEN_OPTS="-Xms256m -Xmx512m". This environment variable can be used to supply extra options to Maven. - Make sure that JAVA_HOME is set to the location of your JDK, e.g.
export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)and that$JAVA_HOME/binis in yourPATHenvironment variable (although that might not be necessary with the latest Mac OS X versions and the Oracle JDK). - Add extracted
apache-maven-3.3.9/binto your$PATH - Run
mvn --versionto verify that it is correctly installed.
- Extract the distribution archive, i.e.
Changing the JDK used by the maven (mvn) formula
How To Install Maven
Just curious, why maven doesn't have an installer? like JDK? and why installers don't set the path automatically to system variables themselves?
Java set up maven
Videos
Alternatively, I recommend installing Homebrew for these kinds of utilities.
Then you just install Maven using:
Copybrew install maven
PS: If you got a 404 error, try doing a brew update just before
Hi,
In case anyone's interested, I put together a brief guide on how to install Apache Maven (on Linux, MacOS and Windows).
I hope you find it useful! :)