Great helps above, but if you having the similar environment like I did, this is how I get it to work.
Edit this file /etc/profile.d/apache-maven.sh, such as the following, note that it will affect the whole system.
$ cat /etc/profile.d/apache-maven.sh
MAVEN_HOME=/usr/share/apache-maven
M2_HOME=$MAVEN_HOME
PATH=$MAVEN_HOME/bin:$PATH
# change below to the jdk you want mvn to reference.
JAVA_HOME=/usr/java/jdk1.7.0_40/
export MAVEN_HOME
export M2_HOME
export PATH
export JAVA_HOME