How to install maven in Mac OS?

What is maven?

Apache maven is a build automation tool that is mainly used in java projects. The word maven means accumulation of knowledge. The main purpose of maven is to simplify the build process for developers. For building a project if the developer follows the guidelines or structure provided by maven then build process becomes easier.

How to install maven in Mac OS?

To install maven first of all we will have to download the latest maven from apache maven site. Following is the download link:

Maven download link

As soon as the download is done, extract the downloaded file and move it to the Library directory. The file we downloaded is: apache-maven-3.6.1-bin.tar.gz and after extracting we had this folder: apache-maven-3.6.1

Inside the Library directory we had to create a Maven directory and moved the apache-maven-3.6.1 inside it. At the end the path was: /Library/Maven/apache-maven-3.6.1

At this point we are very much ready. Now all we need to do is export the path in .bash_profile file.

So add the following lines in the .bash_profile file:

M2_HOME=/Library/Maven/apache-maven-3.6.1/
PATH=$PATH:$M2_HOME/bin
Share