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.
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.)
When I asked yum to install maven2, it declined, saying it had never heard of maven2.
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.
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.)
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 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
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.
Afterwards the process is easy
run the following to extract the tar,
tar xvf apache-maven-3.0.5-bin.tar.gz
move maven to /usr/local/apache-maven
mv apache-maven-3.0.5 /usr/local/apache-maven
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
source ~/.bashrc
6:. Verify everything is working with the following command
mvn -version