|
|
|
@ -108,13 +108,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
|
|
|
|
@ -200,8 +199,89 @@ 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/io/takari/maven-wrapper/0.5.3/maven-wrapper-0.5.3.jar"
|
|
|
|
|
else
|
|
|
|
|
jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.3/maven-wrapper-0.5.3.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"
|
|
|
|
|
else
|
|
|
|
|
wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$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
|
|
|
|
|