由于软件包损坏,Maven 安装在 ubuntu 上失败

Maven install fails on ubuntu due to broken packages

我正在尝试安装 Maven,但收到损坏包的错误消息。我也尝试使用 -f 开关,但没有帮助。

simon@simon-pc:~$ sudo apt-get install -f maven
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 maven : Depends: libaether-java but it is not going to be installed
         Depends: libplexus-containers1.5-java but it is not going to be installed
         Depends: libsisu-ioc-java but it is not going to be installed
         Depends: libwagon-java but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

尝试以下命令:

#sudo apt-get remove maven2
sudo add-apt-repository "deb http://ppa.launchpad.net/natecarlson/maven3/ubuntu precise main"
sudo apt-get update
sudo apt-get install maven3

如果你遇到这种情况:

程序'mvn'可以在以下包中找到:

行家

maven2

试试 sudo apt-get install {selected-package}

#Just add those lines in /etc/profile
export M2_HOME=/usr/share/maven3
export M2=$M2_HOME/bin
export PATH=$M2:$PATH