I have a copy of Oracle JDK 7 installed in my system.
The fix:
To get the correct path, you will need to execute /usr/libexec/java_home to obtain the path.
To automatically set JAVA_HOME in terminal every time, append
export JAVA_HOME=`/usr/libexec/java_home`
to the end of ~/.bash_profile
You should be able to execute mvn in a new terminal.