How to install Maven 3 on Ubuntu 12.04/12.10/13.04/13.10 by using apt-get

I started setting up my Ubuntu 12.10 on April 2013 and the normal apt-get install maven was not working for maven 3 back then.

The manual installation in this post 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.

Automatic Installation via apt-get:

Checkout the manual installation if your current ubuntu can not install maven via common 'apt-get install maven'.

sudo apt-get update
sudo apt-get install maven

Make sure to remove maven 2 if you ubuntu is not fresh or if you were using maven 2 before:

sudo apt-get remove maven2

Manual Installation via apt-get by adding maven 3 repository:

This can be useful if your ubuntu apt-get repositories list is not up to date.

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. Best document I found was:

killertilapia's blog

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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值