Installing Maven On Ubuntu

If you want to install Maven the building tool in Linux Ubuntu you have to install Java first. I already explained how to install Java in this post.

To verify that you already have the Java Development Kit (JDK) open the terminal and run the following command:

Check also if the javac compiler works so that you can be sure that the JDK  is already installed instead of the JRE (Java SE Runtime Environment).

Go to and click on the Download link. The links to latest stable versions of Maven will be displayed.

Move the maven.tar.gz file to /usr/local directory. You will need a superuser or administrator access to place contents in the /usr/local folder.

Extract the maven.tar.gz file, then rename the maven directory to apache-maven using the following Linux commands:

In the following step, we will configure the environment variables that are needed by Apache Maven.

Open the .bashrc file in your home directory and add the following Linux export commands at the end of  file:

Let’s now confirm that Maven has been set up correctly, by running a Maven command:

Open a command prompt and run the following command:

The following output should be displayed:

If you get an error, recheck the installation steps and repeat them.

Happy Coding 🙂




Leave a Reply

Next ArticleHow To Install Eclipse IDE On Ubuntu