mirror of https://github.com/apache/maven.git
Use Apple-recommended strategy for locating JAVA_HOME.
This works correctly with both Oracle and Apple JDKs.
This commit is contained in:
parent
8a3714dd09
commit
b952d3628d
|
@ -54,36 +54,14 @@ case "`uname`" in
|
||||||
CYGWIN*) cygwin=true ;;
|
CYGWIN*) cygwin=true ;;
|
||||||
MINGW*) mingw=true;;
|
MINGW*) mingw=true;;
|
||||||
Darwin*) darwin=true
|
Darwin*) darwin=true
|
||||||
#
|
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
|
||||||
# Look for the Apple JDKs first to preserve the existing behaviour, and then look
|
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
|
||||||
# for the new JDKs provided by Oracle.
|
if [ -z "$JAVA_HOME" ]; then
|
||||||
#
|
if [ -x "/usr/libexec/java_home" ]; then
|
||||||
if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK ] ; then
|
export JAVA_HOME="`/usr/libexec/java_home`"
|
||||||
#
|
else
|
||||||
# Apple JDKs
|
export JAVA_HOME="/Library/Java/Home"
|
||||||
#
|
|
||||||
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Java/JavaVirtualMachines/CurrentJDK ] ; then
|
|
||||||
#
|
|
||||||
# Apple JDKs
|
|
||||||
#
|
|
||||||
export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$JAVA_HOME" ] && [ -L "/Library/Java/JavaVirtualMachines/CurrentJDK" ] ; then
|
|
||||||
#
|
|
||||||
# Oracle JDKs
|
|
||||||
#
|
|
||||||
export JAVA_HOME=/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$JAVA_HOME" ] && [ -x "/usr/libexec/java_home" ]; then
|
|
||||||
#
|
|
||||||
# Apple JDKs
|
|
||||||
#
|
|
||||||
export JAVA_HOME=`/usr/libexec/java_home`
|
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
Loading…
Reference in New Issue