|
|
|
@ -19,7 +19,7 @@
|
|
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
|
# Maven2 Start Up Batch script
|
|
|
|
|
# Maven Start Up Batch script
|
|
|
|
|
#
|
|
|
|
|
# Required ENV vars:
|
|
|
|
|
# ------------------
|
|
|
|
@ -36,6 +36,10 @@
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
@ -54,38 +58,16 @@ case "`uname`" in
|
|
|
|
|
CYGWIN*) cygwin=true ;;
|
|
|
|
|
MINGW*) mingw=true;;
|
|
|
|
|
Darwin*) darwin=true
|
|
|
|
|
#
|
|
|
|
|
# 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/Frameworks/JavaVM.framework/Versions/CurrentJDK ] ; then
|
|
|
|
|
#
|
|
|
|
|
# Apple JDKs
|
|
|
|
|
#
|
|
|
|
|
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home
|
|
|
|
|
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
|
|
|
|
|
;;
|
|
|
|
|
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
|
|
|
|
|
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
|
|
|
|
|
if [ -z "$JAVA_HOME" ]; then
|
|
|
|
|
if [ -x "/usr/libexec/java_home" ]; then
|
|
|
|
|
export JAVA_HOME="`/usr/libexec/java_home`"
|
|
|
|
|
else
|
|
|
|
|
export JAVA_HOME="/Library/Java/Home"
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
;;
|
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
|
if [ -z "$JAVA_HOME" ] ; then
|
|
|
|
@ -130,13 +112,12 @@ if $cygwin ; then
|
|
|
|
|
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# For Migwn, ensure paths are in UNIX format before anything is touched
|
|
|
|
|
# For Mingw, ensure paths are in UNIX format before anything is touched
|
|
|
|
|
if $mingw ; then
|
|
|
|
|
[ -n "$M2_HOME" ] &&
|
|
|
|
|
M2_HOME="`(cd "$M2_HOME"; pwd)`"
|
|
|
|
|
[ -n "$JAVA_HOME" ] &&
|
|
|
|
|
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
|
|
|
|
|
# TODO classpath?
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ -z "$JAVA_HOME" ]; then
|
|
|
|
@ -168,7 +149,7 @@ if [ -z "$JAVACMD" ] ; then
|
|
|
|
|
JAVACMD="$JAVA_HOME/bin/java"
|
|
|
|
|
fi
|
|
|
|
|
else
|
|
|
|
|
JAVACMD="`which java`"
|
|
|
|
|
JAVACMD="`\\unset -f command; \\command -v java`"
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
@ -184,27 +165,28 @@ fi
|
|
|
|
|
|
|
|
|
|
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
|
|
|
|
|
|
|
|
|
|
# For Cygwin, switch paths to Windows format before running java
|
|
|
|
|
if $cygwin; then
|
|
|
|
|
[ -n "$M2_HOME" ] &&
|
|
|
|
|
M2_HOME=`cygpath --path --windows "$M2_HOME"`
|
|
|
|
|
[ -n "$JAVA_HOME" ] &&
|
|
|
|
|
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
|
|
|
|
|
[ -n "$CLASSPATH" ] &&
|
|
|
|
|
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# traverses directory structure from process work directory to filesystem root
|
|
|
|
|
# first directory with .mvn subdirectory is considered project base directory
|
|
|
|
|
find_maven_basedir() {
|
|
|
|
|
local basedir=$(pwd)
|
|
|
|
|
local wdir=$(pwd)
|
|
|
|
|
|
|
|
|
|
if [ -z "$1" ]
|
|
|
|
|
then
|
|
|
|
|
echo "Path not specified to find_maven_basedir"
|
|
|
|
|
return 1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
basedir="$1"
|
|
|
|
|
wdir="$1"
|
|
|
|
|
while [ "$wdir" != '/' ] ; do
|
|
|
|
|
if [ -d "$wdir"/.mvn ] ; then
|
|
|
|
|
basedir=$wdir
|
|
|
|
|
break
|
|
|
|
|
fi
|
|
|
|
|
wdir=$(cd "$wdir/.."; pwd)
|
|
|
|
|
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
|
|
|
|
|
if [ -d "${wdir}" ]; then
|
|
|
|
|
wdir=`cd "$wdir/.."; pwd`
|
|
|
|
|
fi
|
|
|
|
|
# end of workaround
|
|
|
|
|
done
|
|
|
|
|
echo "${basedir}"
|
|
|
|
|
}
|
|
|
|
@ -216,9 +198,108 @@ concat_lines() {
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)}
|
|
|
|
|
BASE_DIR=`find_maven_basedir "$(pwd)"`
|
|
|
|
|
if [ -z "$BASE_DIR" ]; then
|
|
|
|
|
exit 1;
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
##########################################################################################
|
|
|
|
|
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
|
|
|
|
|
# This allows using the maven wrapper in projects that prohibit checking in binary data.
|
|
|
|
|
##########################################################################################
|
|
|
|
|
if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
|
|
|
|
|
if [ "$MVNW_VERBOSE" = true ]; then
|
|
|
|
|
echo "Found .mvn/wrapper/maven-wrapper.jar"
|
|
|
|
|
fi
|
|
|
|
|
else
|
|
|
|
|
if [ "$MVNW_VERBOSE" = true ]; then
|
|
|
|
|
echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
|
|
|
|
|
fi
|
|
|
|
|
if [ -n "$MVNW_REPOURL" ]; then
|
|
|
|
|
jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
|
|
|
|
|
else
|
|
|
|
|
jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
|
|
|
|
|
fi
|
|
|
|
|
while IFS="=" read key value; do
|
|
|
|
|
case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
|
|
|
|
|
esac
|
|
|
|
|
done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
|
|
|
|
|
if [ "$MVNW_VERBOSE" = true ]; then
|
|
|
|
|
echo "Downloading from: $jarUrl"
|
|
|
|
|
fi
|
|
|
|
|
wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
|
|
|
|
|
if $cygwin; then
|
|
|
|
|
wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if command -v wget > /dev/null; then
|
|
|
|
|
if [ "$MVNW_VERBOSE" = true ]; then
|
|
|
|
|
echo "Found wget ... using wget"
|
|
|
|
|
fi
|
|
|
|
|
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
|
|
|
|
wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
|
|
|
|
|
else
|
|
|
|
|
wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
|
|
|
|
|
fi
|
|
|
|
|
elif command -v curl > /dev/null; then
|
|
|
|
|
if [ "$MVNW_VERBOSE" = true ]; then
|
|
|
|
|
echo "Found curl ... using curl"
|
|
|
|
|
fi
|
|
|
|
|
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
|
|
|
|
curl -o "$wrapperJarPath" "$jarUrl" -f
|
|
|
|
|
else
|
|
|
|
|
curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
if [ "$MVNW_VERBOSE" = true ]; then
|
|
|
|
|
echo "Falling back to using Java to download"
|
|
|
|
|
fi
|
|
|
|
|
javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
|
|
|
|
|
# For Cygwin, switch paths to Windows format before running javac
|
|
|
|
|
if $cygwin; then
|
|
|
|
|
javaClass=`cygpath --path --windows "$javaClass"`
|
|
|
|
|
fi
|
|
|
|
|
if [ -e "$javaClass" ]; then
|
|
|
|
|
if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
|
|
|
|
|
if [ "$MVNW_VERBOSE" = true ]; then
|
|
|
|
|
echo " - Compiling MavenWrapperDownloader.java ..."
|
|
|
|
|
fi
|
|
|
|
|
# Compiling the Java class
|
|
|
|
|
("$JAVA_HOME/bin/javac" "$javaClass")
|
|
|
|
|
fi
|
|
|
|
|
if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
|
|
|
|
|
# Running the downloader
|
|
|
|
|
if [ "$MVNW_VERBOSE" = true ]; then
|
|
|
|
|
echo " - Running MavenWrapperDownloader.java ..."
|
|
|
|
|
fi
|
|
|
|
|
("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
##########################################################################################
|
|
|
|
|
# End of extension
|
|
|
|
|
##########################################################################################
|
|
|
|
|
|
|
|
|
|
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
|
|
|
|
|
if [ "$MVNW_VERBOSE" = true ]; then
|
|
|
|
|
echo $MAVEN_PROJECTBASEDIR
|
|
|
|
|
fi
|
|
|
|
|
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
|
|
|
|
|
|
|
|
|
|
# For Cygwin, switch paths to Windows format before running java
|
|
|
|
|
if $cygwin; then
|
|
|
|
|
[ -n "$M2_HOME" ] &&
|
|
|
|
|
M2_HOME=`cygpath --path --windows "$M2_HOME"`
|
|
|
|
|
[ -n "$JAVA_HOME" ] &&
|
|
|
|
|
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
|
|
|
|
|
[ -n "$CLASSPATH" ] &&
|
|
|
|
|
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
|
|
|
|
|
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
|
|
|
|
|
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Provide a "standardized" way to retrieve the CLI args that will
|
|
|
|
|
# work with both Windows and non-Windows executions.
|
|
|
|
|
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
|
|
|
|
@ -226,29 +307,10 @@ export MAVEN_CMD_LINE_ARGS
|
|
|
|
|
|
|
|
|
|
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
|
|
|
|
|
|
|
|
|
echo "Running version check"
|
|
|
|
|
VERSION=$( sed '\!<parent!,\!</parent!d' `dirname $0`/pom.xml | grep '<revision' | head -1 | sed -e 's/.*<revision>//' -e 's!</revision>.*$!!' )
|
|
|
|
|
echo "The found version is [${VERSION}]"
|
|
|
|
|
|
|
|
|
|
if echo $VERSION | egrep -q 'M|RC'; then
|
|
|
|
|
echo Activating \"milestone\" profile for version=\"$VERSION\"
|
|
|
|
|
echo $MAVEN_ARGS | grep -q milestone || MAVEN_ARGS="$MAVEN_ARGS -Pmilestone"
|
|
|
|
|
else
|
|
|
|
|
echo Deactivating \"milestone\" profile for version=\"$VERSION\"
|
|
|
|
|
echo $MAVEN_ARGS | grep -q milestone && MAVEN_ARGS=$(echo $MAVEN_ARGS | sed -e 's/-Pmilestone//')
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if echo $VERSION | egrep -q 'RELEASE'; then
|
|
|
|
|
echo Activating \"central\" profile for version=\"$VERSION\"
|
|
|
|
|
echo $MAVEN_ARGS | grep -q milestone || MAVEN_ARGS="$MAVEN_ARGS -Pcentral"
|
|
|
|
|
else
|
|
|
|
|
echo Deactivating \"central\" profile for version=\"$VERSION\"
|
|
|
|
|
echo $MAVEN_ARGS | grep -q central && MAVEN_ARGS=$(echo $MAVEN_ARGS | sed -e 's/-Pcentral//')
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
exec "$JAVACMD" \
|
|
|
|
|
$MAVEN_OPTS \
|
|
|
|
|
$MAVEN_DEBUG_OPTS \
|
|
|
|
|
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
|
|
|
|
|
"-Drevision=${VERSION}" \
|
|
|
|
|
"-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
|
|
|
|
|
${WRAPPER_LAUNCHER} ${MAVEN_ARGS} "$@"
|
|
|
|
|
"-Dmaven.home=${M2_HOME}" \
|
|
|
|
|
"-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
|
|
|
|
|
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
|
|
|
|
|