How To Install Maven On Ubuntu?

Apache Maven is project management tool which is following the concept of a project object model (POM). Maven can manage project’s build and documentation from a central place. Maven 1 actually was started as a sub project of Apache Turbine in 2002. It was released in July 2004 as v1.0. Maven 2 was released in Oct 2005. It was a complete rewrite of the previous project. It was not backward compatible. Maven 3 was released in October 2010 (Read : What is Apache Maven?).

This tutorial explains the steps to install the maven on Ubuntu 12.0.

1. Get Maven Package

Open the terminal and type the command $ apt-cache search maven. The command prompt will display the available packages which is matching the maven word. In the list, you also can see maven – Java software project management and comprehension tool. This package will always have the latest package.

Search Maven in Ubuntu

2. Install The Package

Run the command $ sudo apt-get install maven through the same above terminal. It will ask for the root password and some confirmation messages. Just follow and answer the questions till the installation is completed. Since the installation is done by downloading the entire package, it takes several minutes to download the entire mavan files. Note that you should have internet connection for installing the maven through the command prompt. It is the easiest way to install the package. Wait till the installation is completed.

3. Test The Maven Installation in Ubuntu

Run the command mvn -version to check if the maven is installed properly. You will see the below description on the command prompt.

krishna@krishna-desktop:~$ mvn -version
Apache Maven 3.0.4
Maven home: /usr/share/maven
Java version: 1.6.0_27, vendor: Sun Microsystems Inc.
Java home: /usr/lib/jvm/java-6-openjdk-i386/jre
Default locale: en_IN, platform encoding: UTF-8
OS name: "linux", version: "3.2.0-51-generic", arch: "i386", family: "unix"

Maven is installed successfully. I found the installation on Ubuntu is much simpler than installing on Windows operating system. I would continue writing few more tips on using the various tools on Ubuntu OS. It is great experience on using Ubuntu for developing the Java applications. I would recommend you to try once, then you will never look back.

If you are facing any issues, please write it in the comments section.



About Krishna Srinivasan

He is Founder and Chief Editor of JavaBeat. He has more than 8+ years of experience on developing Web applications. He writes about Spring, DOJO, JSF, Hibernate and many other emerging technologies in this blog.