How do I install Maven 3?

There are two useful publications on this specific topic here:

  • Installing Maven 3 on Ubuntu 10.04 LTS Server « Trial and Terror

  • installing maven 3 from a binary deb on ubuntu « Discursive

PPA with Maven 3, built by Nate Carlson:

https://launchpad.net/~natecarlson/+archive/maven3


It is not in the repositories, and from my experience the best solution is to download it from apache.org, untar it into /home/youruser/maven and then add it to your path like explained here.

Uninstall your current maven 2 before doing this of course.


I started setting up my Ubuntu 12.10 for the project I am working on. Maven 3 was required to set up the system and as it turns out most of the documents out there are referring to how to install Maven to Ubuntu version 12.04 or before.

The manual installation is useful if you like to dig in deeper to your ubuntu kernel in regards with apt-get and where it finds the list of applications that are available for installation on Ubuntu . It can also be potentially useful for more recent releases of Ubuntu like Ubuntu 13.04, etc. if you face the same problem as I did back then with Ubuntu 12.10. Best document I found was:

killertilapia.blogspot.com.au/2012/10/installing-maven-3-in-ubuntu-1204.html

Manual installation:

The whole process I came up with is as follows:

  1. sudo -H gedit /etc/apt/sources.list
  2. Add the following line the sources.list file:

    deb http://ppa.launchpad.net/natecarlson/maven3/ubuntu precise main

    deb-src http://ppa.launchpad.net/natecarlson/maven3/ubuntu precise main

  3. sudo apt-get update && sudo apt-get install maven3

  4. sudo ln -s /usr/share/maven3/bin/mvn /usr/bin/mvn

Caution 1: command "sudo add-apt-repository ppa:natecarlson/maven3" did not work on my Ubuntu and had to run "sudo add-apt-repository -rm ppa:natecarlson/maven3" to get my apt-get to work again.

Caution 2: thanks to David, you need to remove your existing symbolic link to previous versions of maven before running step 4.

Automatic Installation:

sudo apt-get remove maven2
sudo apt-get update
sudo apt-get install maven

Some information is also available here for both the manual and the automatic installation.