-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Last two bits to be removed: * wrapper lifecycle * exploded scripts --- https://issues.apache.org/jira/browse/MNG-8263
- Loading branch information
Showing
20 changed files
with
410 additions
and
491 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,192 @@ | ||
#!/bin/sh | ||
|
||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
# ----------------------------------------------------------------------------- | ||
# Apache Maven Startup Script | ||
# | ||
# Environment Variable Prerequisites | ||
# | ||
# JAVA_HOME (Optional) Points to a Java installation. | ||
# MAVEN_ARGS (Optional) Arguments passed to Maven before CLI arguments. | ||
# MAVEN_OPTS (Optional) Java runtime options used when Maven is executed. | ||
# MAVEN_SKIP_RC (Optional) Flag to disable loading of mavenrc files. | ||
# ----------------------------------------------------------------------------- | ||
|
||
if [ -z "$MAVEN_SKIP_RC" ] ; then | ||
|
||
if [ -f /usr/local/etc/mavenrc ] ; then | ||
. /usr/local/etc/mavenrc | ||
fi | ||
|
||
if [ -f /etc/mavenrc ] ; then | ||
. /etc/mavenrc | ||
fi | ||
|
||
if [ -f "$HOME/.mavenrc" ] ; then | ||
. "$HOME/.mavenrc" | ||
fi | ||
|
||
fi | ||
|
||
# OS specific support. $var _must_ be set to either true or false. | ||
cygwin=false; | ||
mingw=false; | ||
case "`uname`" in | ||
CYGWIN*) cygwin=true;; | ||
MINGW*) mingw=true;; | ||
esac | ||
|
||
## resolve links - $0 may be a link to Maven's home | ||
PRG="$0" | ||
|
||
# need this for relative symlinks | ||
while [ -h "$PRG" ] ; do | ||
ls=`ls -ld "$PRG"` | ||
link=`expr "$ls" : '.*-> \(.*\)$'` | ||
if expr "$link" : '/.*' > /dev/null; then | ||
PRG="$link" | ||
else | ||
PRG="`dirname "$PRG"`/$link" | ||
fi | ||
done | ||
|
||
saveddir=`pwd` | ||
|
||
MAVEN_HOME=`dirname "$PRG"`/.. | ||
|
||
# make it fully qualified | ||
MAVEN_HOME=`cd "$MAVEN_HOME" && pwd` | ||
|
||
cd "$saveddir" | ||
|
||
CLASSWORLDS_CONF="$MAVEN_HOME/bin/m2.conf" | ||
|
||
# For Cygwin and MinGW, ensure paths are in Unix format before anything is touched | ||
if $cygwin || $mingw ; then | ||
[ -n "$JAVA_HOME" ] && | ||
JAVA_HOME=`cygpath --unix "$JAVA_HOME"` | ||
fi | ||
|
||
if [ -n "$JAVA_HOME" ] ; then | ||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then | ||
# IBM's JDK on AIX uses strange locations for the executables | ||
JAVACMD="$JAVA_HOME/jre/sh/java" | ||
else | ||
JAVACMD="$JAVA_HOME/bin/java" | ||
|
||
if [ ! -x "$JAVACMD" ] ; then | ||
echo "The JAVA_HOME environment variable is not defined correctly, so Apache Maven cannot be started." >&2 | ||
echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" does not exist." >&2 | ||
exit 1 | ||
fi | ||
fi | ||
else | ||
JAVACMD="`\\unset -f command; \\command -v java`" | ||
|
||
if [ ! -x "$JAVACMD" ] ; then | ||
echo "The java(1) command does not exist in PATH nor is JAVA_HOME set, so Apache Maven cannot be started." >&2 | ||
exit 1 | ||
fi | ||
fi | ||
|
||
# traverses directory structure from process work directory to filesystem root | ||
# first directory with .mvn subdirectory is considered project base directory | ||
find_maven_basedir() { | ||
( | ||
basedir=`find_file_argument_basedir "$@"` | ||
wdir="$basedir" | ||
while : | ||
do | ||
if [ -d "$wdir"/.mvn ] ; then | ||
basedir=$wdir | ||
break | ||
fi | ||
if [ "$wdir" = '/' ] ; then | ||
break | ||
fi | ||
wdir=`cd "$wdir/.."; pwd` | ||
done | ||
echo "$basedir" | ||
) | ||
} | ||
|
||
find_file_argument_basedir() { | ||
( | ||
basedir=`pwd` | ||
|
||
found_file_switch=0 | ||
for arg in "$@"; do | ||
if [ ${found_file_switch} -eq 1 ]; then | ||
if [ -d "${arg}" ]; then | ||
basedir=`cd "${arg}" && pwd -P` | ||
elif [ -f "${arg}" ]; then | ||
basedir=`dirname "${arg}"` | ||
basedir=`cd "$basedir" && pwd -P` | ||
if [ ! -d "$basedir" ]; then | ||
echo "Directory $basedir extracted from the -f/--file command-line argument ${arg} does not exist" >&2 | ||
exit 1 | ||
fi | ||
else | ||
echo "POM file ${arg} specified with the -f/--file command line argument does not exist" >&2 | ||
exit 1 | ||
fi | ||
break | ||
fi | ||
if [ "$arg" = "-f" -o "$arg" = "--file" ]; then | ||
found_file_switch=1 | ||
fi | ||
done | ||
echo "$basedir" | ||
) | ||
} | ||
|
||
# concatenates all lines of a file | ||
concat_lines() { | ||
if [ -f "$1" ]; then | ||
echo "`tr -s '\r\n' ' ' < "$1"`" | ||
fi | ||
} | ||
|
||
MAVEN_PROJECTBASEDIR="`find_maven_basedir "$@"`" | ||
MAVEN_OPTS="$MAVEN_OPTS `concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config"`" | ||
LAUNCHER_JAR=`echo "$MAVEN_HOME"/boot/plexus-classworlds-*.jar` | ||
LAUNCHER_CLASS=org.codehaus.plexus.classworlds.launcher.Launcher | ||
|
||
# For Cygwin and MinGW, switch paths to Windows format before running java(1) command | ||
if $cygwin || $mingw ; then | ||
[ -n "$JAVA_HOME" ] && | ||
JAVA_HOME=`cygpath --windows "$JAVA_HOME"` | ||
LAUNCHER_JAR=`cygpath --windows "$LAUNCHER_JAR"` | ||
CLASSWORLDS_CONF=`cygpath --windows "$CLASSWORLDS_CONF"` | ||
MAVEN_HOME=`cygpath --windows "$MAVEN_HOME"` | ||
MAVEN_PROJECTBASEDIR=`cygpath --windows "$MAVEN_PROJECTBASEDIR"` | ||
fi | ||
|
||
exec "$JAVACMD" \ | ||
$MAVEN_OPTS \ | ||
$MAVEN_DEBUG_OPTS \ | ||
--enable-native-access=ALL-UNNAMED \ | ||
-classpath "$LAUNCHER_JAR" \ | ||
"-Dclassworlds.conf=$CLASSWORLDS_CONF" \ | ||
"-Dmaven.home=$MAVEN_HOME" \ | ||
"-Dlibrary.jansi.path=${MAVEN_HOME}/lib/jansi-native" \ | ||
"-Dmaven.multiModuleProjectDirectory=$MAVEN_PROJECTBASEDIR" \ | ||
$LAUNCHER_CLASS \ | ||
$MAVEN_ARGS \ | ||
"$@" |
Oops, something went wrong.