我如何在Yum中安装Maven? [英] How do I install Maven with Yum?
问题描述
我正在尝试 not 来学习有关yum或maven的更多信息.我已经继承了这段代码,并且我不想在这种环境中花费更多的时间.
I'm trying not to learn much about either yum or maven. I've inherited this code and I don't want to spend more time than I have to in this environment.
我好吃.我的安装有"(也有附件"吗?知道"吗?)两个存储库:Amazon存储库和JPackage,据我了解这是一个标准. (实际上,每个存储库都包含两个子存储库,但我认为这不是问题所在.)
I've got yum. My installation "has" ("is attached too"? "knows about"?) two repos: the Amazon one and JPackage, which I understand is something of a standard. (Actually, each of those repositories consists of two sub-repositories, but I don't think that's causing the problem.)
当我要求yum安装maven2时,它拒绝了,说它从未听说过maven2.
When I asked yum to install maven2, it declined, saying it had never heard of maven2.
当我要求yum安装maven2 而忽略Amazon 时,它会这样做,但是会安装相当老的Maven 2.0.9.我实际使用的pom.xml需要更高的版本.
When I asked yum to install maven2 ignoring Amazon, it does so, but it installs Maven 2.0.9, which is fairly old. The actual pom.xml I have requires a higher version.
当我使用Google for Maven存储库时,我会得到Maven可以用来构建其他东西的存储库,而不是Yum可以用来安装Maven的存储库. (我确实找到了一个存储库,其中包含可以让Maven构建Yum的存储库.我认为Google目前在嘲笑我.)
When I Google for Maven repositories I get repositories that Maven can use to build other things, not repositories that Yum can use to install Maven. (I did find a repository containing thing that let Maven build Yum. I think Google is mocking me at this point.)
因此,我所需要的只是存储库文件,该文件指向包含我安装Maven 2.2.1所需内容的存储库.
So, all I need is the repo file that points to a repo that contains whatever I need to install Maven 2.2.1.
如果不是所有这些省力的设备,我可能可以完成一些工作.
If it weren't for all these labor-saving devices, I could probably get some work done.
推荐答案
Icarus为我回答了一个非常相似的问题.它不使用"yum",但仍然可以满足您的目的.试试吧,
Icarus answered a very similar question for me. Its not using "yum", but should still work for your purposes. Try,
wget http://mirror.olnevhost.net/pub/apache/maven/maven-3/3.0.5/binaries/apache-maven-3.0.5-bin.tar.gz
基本上只需转到 maven网站.查找所需的Maven版本.文件类型,并在上面的wget语句中使用镜像.
basically just go to the maven site. Find the version of maven you want. The file type and use the mirror for the wget statement above.
随后的过程很简单
- 也从要提取Maven的目录中运行wget命令.
-
运行以下命令以提取tar,
- Run the wget command from the dir you want to extract maven too.
run the following to extract the tar,
tar xvf apache-maven-3.0.5-bin.tar.gz
将Maven移至/usr/local/apache-maven
move maven to /usr/local/apache-maven
mv apache-maven-3.0.5 /usr/local/apache-maven
接下来将env变量添加到您的〜/.bashrc文件
Next add the env variables to your ~/.bashrc file
export M2_HOME=/usr/local/apache-maven
export M2=$M2_HOME/bin
export PATH=$M2:$PATH
执行这些命令
Execute these commands
源〜/.bashrc
source ~/.bashrc
6:使用以下命令验证一切正常
6:. Verify everything is working with the following command
mvn -version
这篇关于我如何在Yum中安装Maven?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!