go here I am setting up my new MAC pro for Java development. As I am new to MAC, I find issues while installing and configuring JAVA_HOME variable. Finally I got the solution and I explained in my JAVA_HOME post that how to configure the variable. In this post I am going to show you how to install Maven on MAC.
What is Maven
http://crazybitchmagazine.com/about/ Apache Maven is a build tool which helps Java developers in building and managing projects. Here are the few features of Maven,
- It makes the build process easy
- It provides a uniform build system
- It provides quality project information
- It allow transparent migration to new features
Installing Maven on Mac OS
source link Now MAC OS is not coming with default installation of Maven. The time when I am writing this post I am using MacOS 10.12. To verify if the Maven is installed or not on the machine. Open the terminal window and type mvn and hit enter. If you get the message “command not found” then it means Maven is not installed. Download it from the Apache Maven website. And unzip the folder. Make sure you unzip the file in a proper location. I created a WorkSpace folder in my documents and I move the unzip folder in that. The path on MAC looks like this /Users/waqas80/Documents/WorkSpace/apache-maven-3.3.9 .
Before configuring it make sure you have install JDK on your machine and JAVA_HOME variable is set. You can type java -version in the terminal window to check if JDK is installed or not.
One JDK is set, follow the below steps,
- Add M2_HOME environment variable by typing the following command in the terminal window, make sure to give the correct path of Maven unzip folder.
- Next is to add M2 environment variable, type the following command in the terminal window
- Next add M2 environment variable to path export PATH=$M2:$PATH
Installing Maven on Mac simple method
Another simple way of installing Maven on Mac or Linux is, download the maven from the website. Extract the zip file and type the below command in the terminal window,
I extract the maven zip file in the documents. Once the path is exported type the following command in the terminal, if you see the below result then it means the maven is successfully configured.