如何使用apt-get在Ubuntu 18.04/17.04/16.10/16.04 LTS/15.10/15.04/14.10/14.04 LTS/13.10/13.04上安装Maven 3? [英] How to install Maven 3 on Ubuntu 18.04/17.04/16.10/16.04 LTS/15.10/15.04/14.10/14.04 LTS/13.10/13.04 by using apt-get?

查看:145
本文介绍了如何使用apt-get在Ubuntu 18.04/17.04/16.10/16.04 LTS/15.10/15.04/14.10/14.04 LTS/13.10/13.04上安装Maven 3?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试:

sudo apt-get install maven

如果对您有用,请忽略本文的其余部分.

If it works for you ignore the rest of this post.

我从2013年4月开始设置Ubuntu 12.10,当时普通的sudo apt-get install maven不适用于maven 3.

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

如果您想深入了解apt-get方面的ubuntu内核,并在其中找到可用于在Ubuntu上安装的应用程序列表,则本文中的手动安装非常有用. .如果您遇到的问题与我当时使用Ubuntu 12.10时遇到的问题相同,那么它对于诸如 Ubuntu 15.04 等最新版本的Ubuntu也可能很有用.

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 15.04, etc. if you face the same problem as I did back then with Ubuntu 12.10.

如果您当前的ubuntu无法通过常见的"apt-get install maven"安装maven,请签出手动安装.

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

如果您的Ubuntu不新鲜或以前使用过Maven 2,请确保删除Maven 2:

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

sudo apt-get remove maven2

通过添加maven 3存储库通过apt-get进行手动安装(Ubuntu 14.04检出更新1):

如果您的ubuntu apt-get存储库列表不是最新的,这将很有用.

Manual Installation via apt-get by adding maven 3 repository (Ubuntu 14.04 check out update 1):

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

需要Maven 3来设置系统,并且事实证明,那里的大多数文档都涉及到如何将Maven安装到Ubuntu 12.04或更低版本.我发现的最佳文档是:

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的博客

我想到的整个过程如下:

The whole process I came up with is as follows:

  1. sudo -H gedit /etc/apt/sources.list
  2. sources.list文件中添加以下行:

  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 精确主线

deb-src http://ppa.launchpad.net/natecarlson/maven3/ubuntu精确主线

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

  • sudo apt-get update && sudo apt-get install maven3

    警告1:命令"sudo apt-add-repository ppa:natecarlson/maven3"在我的Ubuntu上不起作用,必须运行sudo apt-add-repository -rm ppa:natecarlson/maven3才能使我的apt-get重新工作.

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

    警告2:多亏了David,您需要在运行步骤4之前删除现有的指向以前版本的maven的符号链接.

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

    OS X安装

    我决定添加OS X安装,以防开发人员使用多个环境:有关更多详细信息,请参见源stackoverflow线程..

    安装与apt-get等效的 Homebrew ,然后使用以下命令安装Maven:

    Install Homebrew that is the equavalent of apt-get, then install Maven using:

    brew install maven
    

    更新1 : Ubunutu 14.04的安装

    我自己没有尝试过,但是我相信这应该在没有安全警告的情况下起作用:

    Update 1: Installation for Ubunutu 14.04

    Haven't tried this myself but I am confident this should work without security warnings:

    sudo apt-get purge maven maven2 maven3
    sudo apt-add-repository ppa:andrei-pozolotin/maven3
    sudo apt-get update
    sudo apt-get install maven3
    

    注意:来源此处,非常感谢@ rendybjunior,@ Dominic_Bartl和@ FunThomas424242

    Note: source here, many thanks and +1s to @rendybjunior, @Dominic_Bartl, and @FunThomas424242

    推荐答案

    这是一种更简单的方法:

    Here's an easier way:

    sudo apt-get install maven
    

    更多详细信息在此处.

    这篇关于如何使用apt-get在Ubuntu 18.04/17.04/16.10/16.04 LTS/15.10/15.04/14.10/14.04 LTS/13.10/13.04上安装Maven 3?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆