在Ubuntu上安装Maven

时间:2014-11-14 06:55:25

标签: maven ubuntu-12.04

我无法在Ubuntu 12.04中安装maven

我试过:sudo apt-get install maven

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package maven is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'maven' has no installation candidate

当我运行:apt-cache search maven

libapache-pom-java - Maven metadata for all Apache Software projects
libcommons-parent-java - Maven metadata for Apache Commons project
maven-ant-helper - helper scripts for building Maven components with ant
maven-repo-helper - Helper tools for including Maven metadata in Debian packages
libjenkins-plugin-parent-java - Jenkins Plugin Parent Maven POM

我收到这样的消息。如何解决这个问题?

2 个答案:

答案 0 :(得分:3)

首先搜索Maven包....

为此在终端运行此命令..

apt-cache search maven

然后安装......

sudo apt-get install maven

最后进行验证......

mvn -version

希望这会帮助你......;)

答案 1 :(得分:0)

从apache maven官方网站下载maven并摘录。

将应用程序目录移动到/ usr / local

sudo cp -R apache-maven-X.X.X /usr/local

在/ usr / bin中建立一个软链接,以便mvn

的通用访问
sudo ln -s /usr/local/apache-maven-X.X.X/bin/mvn /usr/bin/mvn

验证mvn安装

mvn --version