try :
sudo apt-get install maven
如果它对你有用,忽略这篇文章的其余部分.
简介
2013年4月,我开始安装我的Ubuntu 12.10,而普通的sudo apt-get install maven
在那时并不适用于maven 3.
如果你想更深入地了解你的ubuntu内核关于apt get的内容,以及它在哪里找到可以在ubuntu上安装的应用程序列表,那么这篇文章中的manual installation是有用的
通过apt get自动安装:
如果你当前的ubuntu无法通过常见的"apt get install maven"安装maven,请查看manual installation.
sudo apt-get update
sudo apt-get install maven
如果您的ubuntu不 fresh 或之前使用的是maven 2,请确保删除maven 2:
sudo apt-get remove maven2
通过添加maven 3存储库通过apt get手动安装(Ubuntu 14.04查看更新1):
如果你的ubuntu apt get repositories列表不是最新的,这会很有用.
Maven 3是安装系统所必需的,事实证明,大多数文档都是关于如何将Maven安装到Ubuntu12.04或之前的版本.我找到的最好的文件是:
我想出的整个过程如下:
-
sudo -H gedit /etc/apt/sources.list
个 -
在
sources.list
文件中添加以下行:Deb http://ppa.launchpad.net/natecarlson/maven3/ubuntu精密干管
deb src http://ppa.launchpad.net/natecarlson/maven3/ubuntu精密干管
sudo apt-get update && sudo apt-get install maven3
-
sudo ln -s /usr/share/maven3/bin/mvn /usr/bin/mvn
个
警告1:命令"sudo apt add repository ppa:natecarlson/maven3"在我的Ubuntu上不起作用,必须运行
sudo apt-add-repository -rm ppa:natecarlson/maven3
才能让我的apt再次工作.警告2:多亏了David,在运行步骤4之前,您需要删除到maven早期版本的现有符号链接.
OS X安装
我决定添加OSX安装,以防您的开发使用多个环境:See the source stackoverflow thread for more details.
安装与apt-get
相同的Homebrew,然后使用以下方法安装Maven:
brew install maven
Update 1: Installation for Ubunutu 14.04
我自己还没有试过,但我相信这应该可以在没有安全警告的情况下工作:
sudo apt-get purge maven maven2 maven3
sudo apt-add-repository ppa:andrei-pozolotin/maven3
sudo apt-get update
sudo apt-get install maven3
Note:来源here,非常感谢@rendybjunior、@Dominic_Bartl和@funthomas4242