JAVA_HOME error while maven build, OSX-10.8.4 Version
Apple recommends to set JAVA_HOME to “/usr/libexec/java_home“. 

What worked for me was wrapping this around $(). So I ended up configuring JAVA_HOME like $(/usr/libexec/java_home) with the following commands:

vim ~/.bash_profile 
export JAVA_HOME=$(/usr/libexec/java_home)
source ~/.bash_profile