Hello, Today we will be going through a brief explanation on how to install maven on a Macbook.
But before we proceed, for those that are encountering maven for the first time, we going to define maven and get to know and understand what it has to offer.
What is Maven?
Apache Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project's build, reporting and documentation from a central piece of information.
Basically when broken down to the most simplest definition, Maven is:
- Build tool (Similar to ant)
- Project management tool
Ok, now back to the topic at hand, installing maven on a Macbook. I’m going to provide you with a quick step-by-step guide and I hope it will be of great use to you.
Before we proceed, you have to download Apache Maven. You can download maven on the following site:
N.B. For this guide, the .zip format was downloaded and I’ll be using the version 3.3.9 of apache maven.
When your download is completed, run Terminal and check the java jre version that is running on your machine. I recommend using the latest java jre version. You can download it at:
Ok, back to checking your machine’s java jre version, after running terminal, type in the following command:
If your java version is not pointing to the latest version you installed, you can change it using:
N.B. for this guide, version 1.8.0_60 was used.
N.B. In your case, you are going to input to your latest jdk folder instead of “jdk1.8.0_60.jdk”.
After completing the previous steps, still using the terminal, navigate to where your downloaded maven .zip file is located. In my case it’s located under:
$> cd Downloads/Maven/
So we going to put the terminal on hold for a second. That doesn’t mean you must close it. Go to finder , on the menu bar (located on the top of your screen), click on “Go” and type “/usr/local/”. Reason why we are navigating to that folder is because that’s where we are going to extract the contents inside the zip folder and it’s recommended for the contents to be located there for accessibility purposes.
What you’re going to do now is create a new folder and rename it to “apache-maven” but you will need admin permission in doing so. You will have t o insert your password.
After the folder has been created, let’s go back to our terminal. Type in the following command to unzip the downloaded apache maven zip file, to the folder we recently created under the folder “local”:
$>unzip apache-maven-3.3.9-bin.zip –d /usr/local/apache-maven
N.B. You can go to finder, under local, and check that the files are all extracted successfully.
Now we’ve reached the final phase. Run the following commands to complete your maven installation:
After running the commands, you would have successfully installed maven on your Macbook. To verify that it works, using the terminal, type in:
if the command is executed successfully and you are displayed with information regarding your apache maven, Then you have completed the installation of apache maven.
Here is a link for those that prefer a visual explanation on how to install apache maven.