|
@@ -54,38 +54,16 @@ case "`uname`" in
|
54
|
54
|
CYGWIN*) cygwin=true ;;
|
55
|
55
|
MINGW*) mingw=true;;
|
56
|
56
|
Darwin*) darwin=true
|
57
|
|
- #
|
58
|
|
- # Look for the Apple JDKs first to preserve the existing behaviour, and then look
|
59
|
|
- # for the new JDKs provided by Oracle.
|
60
|
|
- #
|
61
|
|
- if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK ] ; then
|
62
|
|
- #
|
63
|
|
- # Apple JDKs
|
64
|
|
- #
|
65
|
|
- export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home
|
66
|
|
- fi
|
67
|
|
-
|
68
|
|
- if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Java/JavaVirtualMachines/CurrentJDK ] ; then
|
69
|
|
- #
|
70
|
|
- # Apple JDKs
|
71
|
|
- #
|
72
|
|
- export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
|
73
|
|
- fi
|
74
|
|
-
|
75
|
|
- if [ -z "$JAVA_HOME" ] && [ -L "/Library/Java/JavaVirtualMachines/CurrentJDK" ] ; then
|
76
|
|
- #
|
77
|
|
- # Oracle JDKs
|
78
|
|
- #
|
79
|
|
- export JAVA_HOME=/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
|
80
|
|
- fi
|
81
|
|
-
|
82
|
|
- if [ -z "$JAVA_HOME" ] && [ -x "/usr/libexec/java_home" ]; then
|
83
|
|
- #
|
84
|
|
- # Apple JDKs
|
85
|
|
- #
|
86
|
|
- export JAVA_HOME=`/usr/libexec/java_home`
|
87
|
|
- fi
|
88
|
|
- ;;
|
|
57
|
+ # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
|
|
58
|
+ # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
|
|
59
|
+ if [ -z "$JAVA_HOME" ]; then
|
|
60
|
+ if [ -x "/usr/libexec/java_home" ]; then
|
|
61
|
+ export JAVA_HOME="`/usr/libexec/java_home`"
|
|
62
|
+ else
|
|
63
|
+ export JAVA_HOME="/Library/Java/Home"
|
|
64
|
+ fi
|
|
65
|
+ fi
|
|
66
|
+ ;;
|
89
|
67
|
esac
|
90
|
68
|
|
91
|
69
|
if [ -z "$JAVA_HOME" ] ; then
|
|
@@ -184,27 +162,28 @@ fi
|
184
|
162
|
|
185
|
163
|
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
|
186
|
164
|
|
187
|
|
-# For Cygwin, switch paths to Windows format before running java
|
188
|
|
-if $cygwin; then
|
189
|
|
- [ -n "$M2_HOME" ] &&
|
190
|
|
- M2_HOME=`cygpath --path --windows "$M2_HOME"`
|
191
|
|
- [ -n "$JAVA_HOME" ] &&
|
192
|
|
- JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
|
193
|
|
- [ -n "$CLASSPATH" ] &&
|
194
|
|
- CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
|
195
|
|
-fi
|
196
|
|
-
|
197
|
165
|
# traverses directory structure from process work directory to filesystem root
|
198
|
166
|
# first directory with .mvn subdirectory is considered project base directory
|
199
|
167
|
find_maven_basedir() {
|
200
|
|
- local basedir=$(pwd)
|
201
|
|
- local wdir=$(pwd)
|
|
168
|
+
|
|
169
|
+ if [ -z "$1" ]
|
|
170
|
+ then
|
|
171
|
+ echo "Path not specified to find_maven_basedir"
|
|
172
|
+ return 1
|
|
173
|
+ fi
|
|
174
|
+
|
|
175
|
+ basedir="$1"
|
|
176
|
+ wdir="$1"
|
202
|
177
|
while [ "$wdir" != '/' ] ; do
|
203
|
178
|
if [ -d "$wdir"/.mvn ] ; then
|
204
|
179
|
basedir=$wdir
|
205
|
180
|
break
|
206
|
181
|
fi
|
207
|
|
- wdir=$(cd "$wdir/.."; pwd)
|
|
182
|
+ # workaround for JBEAP-8937 (on Solaris 10/Sparc)
|
|
183
|
+ if [ -d "${wdir}" ]; then
|
|
184
|
+ wdir=`cd "$wdir/.."; pwd`
|
|
185
|
+ fi
|
|
186
|
+ # end of workaround
|
208
|
187
|
done
|
209
|
188
|
echo "${basedir}"
|
210
|
189
|
}
|
|
@@ -216,13 +195,26 @@ concat_lines() {
|
216
|
195
|
fi
|
217
|
196
|
}
|
218
|
197
|
|
219
|
|
-export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)}
|
|
198
|
+BASE_DIR=`find_maven_basedir "$(pwd)"`
|
|
199
|
+if [ -z "$BASE_DIR" ]; then
|
|
200
|
+ exit 1;
|
|
201
|
+fi
|
|
202
|
+
|
|
203
|
+export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
|
|
204
|
+echo $MAVEN_PROJECTBASEDIR
|
220
|
205
|
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
|
221
|
206
|
|
222
|
|
-# Provide a "standardized" way to retrieve the CLI args that will
|
223
|
|
-# work with both Windows and non-Windows executions.
|
224
|
|
-MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
|
225
|
|
-export MAVEN_CMD_LINE_ARGS
|
|
207
|
+# For Cygwin, switch paths to Windows format before running java
|
|
208
|
+if $cygwin; then
|
|
209
|
+ [ -n "$M2_HOME" ] &&
|
|
210
|
+ M2_HOME=`cygpath --path --windows "$M2_HOME"`
|
|
211
|
+ [ -n "$JAVA_HOME" ] &&
|
|
212
|
+ JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
|
|
213
|
+ [ -n "$CLASSPATH" ] &&
|
|
214
|
+ CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
|
|
215
|
+ [ -n "$MAVEN_PROJECTBASEDIR" ] &&
|
|
216
|
+ MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
|
|
217
|
+fi
|
226
|
218
|
|
227
|
219
|
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
228
|
220
|
|
|
@@ -230,4 +222,4 @@ exec "$JAVACMD" \
|
230
|
222
|
$MAVEN_OPTS \
|
231
|
223
|
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
|
232
|
224
|
"-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
|
233
|
|
- ${WRAPPER_LAUNCHER} "$@"
|
|
225
|
+ ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
|