MNG-5376: Account for changes between the Apple and Oracle JDKs on OSX

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@1412409 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason van Zyl 2012-11-22 02:24:16 +00:00
parent 4e52800a1b
commit 325972aed0
1 changed files with 17 additions and 5 deletions

View File

@ -54,12 +54,24 @@ case "`uname`" in
CYGWIN*) cygwin=true ;;
MINGW*) mingw=true;;
Darwin*) darwin=true
if [ -z "$JAVA_VERSION" ] ; then
JAVA_VERSION="CurrentJDK"
fi
if [ -z "$JAVA_HOME" ] ; then
JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/${JAVA_VERSION}/Home
#
# Look for the Apple JDKs first to preserve the existing behaviour, and then look
# for the new JDKs provided by Oracle.
#
if [[ -z "$JAVA_HOME" && -L /System/Library/Java/JavaVirtualMachines/CurrentJDK ]] ; then
#
# Apple JDKs
#
JAVA_HOME=/System/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
fi
if [[ -z "$JAVA_HOME" && -L "/Library/Java/JavaVirtualMachines/CurrentJDK" ]] ; then
#
# Oracle JDKs
#
JAVA_HOME=/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
fi
;;
esac