Maven For Mac



To install Maven on OS X, go to the Apache Maven website and download the binary zip file. You can then shift the apache-maven-3.0.5 folder in your Downloads folder to wherever you want to keep Maven; however as the rest of the process involves the command line, I. Maven is the most widely used build and project dependency management tool for Java-based applications. We can install Maven on Mac OS using a package manager such as HomeBrew or through XCode Command Line Tools. But, in this tutorial, we will learn how to install Maven on Mac OS without using any other software. Maven requires Java to execute. Verify Java Installation on your Machine. Open console and execute the following java command. Maven is a tool that is also available on Mac machine. The setup is almost similar to what we have to do on a Windows machine. Maven basics remain the same across Windows and Mac machines. However, the installation part differs. Step 1 – Download Maven binaries First, we have to download to Maven binaries. The latest version of Maven isMaven 3.3.3. Add maven path in environment variable; Verify Maven; 1) Download Maven. To install maven on windows, you need to download apache maven first. Download Maven latest Maven software from Download latest version of Maven. For example: apache-maven-3.1.1-bin.zip. Now it will look like this: 2) Add MAVENHOME in environment variable.

Maven Mac Os

  • Maven Tutorial
  • Maven Useful Resources
  • Selected Reading

Maven is a Java based tool, so the very first requirement is to have JDK installed on your machine.

System Requirement

JDK1.7 or above.
MemoryNo minimum requirement.
Disk SpaceNo minimum requirement.
Operating SystemNo minimum requirement.

Step 1 - Verify Java Installation on your Machine

Open console and execute the following java command.

OSTaskCommand
WindowsOpen Command Consolec:> java -version
LinuxOpen Command Terminal$ java -version
MacOpen Terminalmachine:~ joseph$ java -version

Let's verify the output for all the operating systems −

OSOutput
Windows

java version '1.7.0_60'

Java(TM) SE Runtime Environment (build 1.7.0_60-b19)

Java HotSpot(TM) 64-Bit Server VM (build 24.60-b09, mixed mode)

Linux

java version '1.7.0_60'

Java(TM) SE Runtime Environment (build 1.7.0_60-b19)

Java HotSpot(TM) 64-Bit Server VM (build 24.60-b09, mixed mode)

Mac

java version '1.7.0_60'

Java(TM) SE Runtime Environment (build 1.7.0_60-b19)

Java HotSpot(TM) 64-Bit Server VM (build 24.60-b09, mixed mode)

If you do not have Java installed, install the Java Software Development Kit (SDK) from https://www.oracle.com/technetwork/java/javase/downloads/index.html. We are assuming Java 1.7.0.60 as installed version for this tutorial.

Step 2 - Set JAVA Environment

Set the JAVA_HOME environment variable to point to the base directory location where Java is installed on your machine. For example −

OSOutput
WindowsSet the environment variable JAVA_HOME to C:Program FilesJavajdk1.7.0_60
Linuxexport JAVA_HOME=/usr/local/java-current
Macexport JAVA_HOME=/Library/Java/Home

Append Java compiler location to System Path.

OSOutput
WindowsAppend the string “;C:Program FilesJavajdk1.7.0.60bin” to the end of the system variable, Path.
Linuxexport PATH=$PATH:$JAVA_HOME/bin/
Macnot required

Verify Java Installation using java -version command as explained above.

Step 3 - Download Maven Archive

Download Maven 2.2.1 from https://maven.apache.org/download.cgi.

OSArchive name
Windowsapache-maven-3.3.1-bin.zip
Linuxapache-maven-3.3.1-bin.tar.gz
Macapache-maven-3.3.1-bin.tar.gz

Step 4 - Extract the Maven Archive

Extract the archive, to the directory you wish to install Maven 3.3.1. The subdirectory apache-maven-3.3.1 will be created from the archive.

OSLocation (can be different based on your installation)
WindowsC:Program FilesApache Software Foundationapache-maven-3.3.1
Linux/usr/local/apache-maven
Mac/usr/local/apache-maven

Step 5 - Set Maven Environment Variables

Add M2_HOME, M2, MAVEN_OPTS to environment variables.

OSOutput
Windows

Set the environment variables using system properties.

M2_HOME=C:Program FilesApache Software Foundationapache-maven-3.3.1 M2=%M2_HOME%bin MAVEN_OPTS=-Xms256m -Xmx512m

Linux

Open command terminal and set environment variables.

export M2_HOME=/usr/local/apache-maven/apache-maven-3.3.1 export M2=$M2_HOME/bin

export MAVEN_OPTS=-Xms256m -Xmx512m

Mac

Open command terminal and set environment variables.

export M2_HOME=/usr/local/apache-maven/apache-maven-3.3.1

export M2=$M2_HOME/bin

export MAVEN_OPTS=-Xms256m -Xmx512m

Step 6 - Add Maven bin Directory Location to System Path

Now append M2 variable to System Path.

Maven For Mac
OSOutput
WindowsAppend the string ;%M2% to the end of the system variable, Path.
Linuxexport PATH=$M2:$PATH
Macexport PATH=$M2:$PATH

Step 7 - Verify Maven Installation

Now open console and execute the following mvn command.

OSTaskCommand
WindowsOpen Command Consolec:> mvn --version
LinuxOpen Command Terminal$ mvn --version
MacOpen Terminalmachine:~ joseph$ mvn --version
Maven for mac os

Finally, verify the output of the above commands, which should be as follows −

OSOutput
Windows

Apache Maven 3.3.1 (r801777; 2009-08-07 00:46:01+0530)

Java version: 1.7.0_60

Java home: C:Program FilesJavajdk1.7.0_60 jre

Linux

Apache Maven 3.3.1 (r801777; 2009-08-07 00:46:01+0530)

Java version: 1.7.0_60

Java home: C:Program FilesJavajdk1.7.0_60 jre

Mac

Apache Maven 3.3.1 (r801777; 2009-08-07 00:46:01+0530)

Java version: 1.7.0_60

Java home: C:Program FilesJavajdk1.7.0_60 jre

You can download and install maven on windows, linux and MAC OS platforms. Here, we are going to learn how to install maven on windows OS.

To install maven on windows, you need to perform following steps:

  1. Download maven and extract it
  2. Add JAVA_HOME and MAVEN_HOME in environment variable
  3. Add maven path in environment variable
  4. Verify Maven

1) Download Maven

To install maven on windows, you need to download apache maven first.

Maven Download For Windows 10

Download Maven latest Maven software from Download latest version of Maven

For example: apache-maven-3.1.1-bin.zip

Maven For Mac Brew

Extract it. Now it will look like this:

2) Add MAVEN_HOME in environment variable

Right click on MyComputer ->properties ->Advanced System Settings ->Environment variables ->click new button

Now add MAVEN_HOME in variable name and path of maven in variable value. It must be the home directory of maven i.e. outer directory of bin. For example: E:apache-maven-3.1.1 .It is displayed below:

Maven For Mac

Now click on OK button.

3) Add Maven Path in environment variable

Apache Maven For Mac

Click on new tab if path is not set, then set the path of maven. If it is set, edit the path and append the path of maven.

Here, we have installed JDK and its path is set by default, so we are going to append the path of maven.

The path of maven should be %maven home%/bin. For example, E:apache-maven-3.1.1bin .

Download Maven For Mac

4)Verify maven

To verify whether maven is installed or not, open the command prompt and write:

Now it will display the version of maven and jdk including the maven home and java home.

Let's see the output: