#!/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 Wrapper startup script, version 3.3.2 # ---------------------------------------------------------------------------- # Required ENV vars: # JAVA_HOME - location of a JDK home dir # # Optional ENV vars: # MAVEN_OPTS - parameters passed to the Java VM, e.g. -Xmx512m # MAVEN_SKIP_RC - 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. cygwin=false; darwin=false; mingw=false case "$(uname)" in CYGWIN*) cygwin=true ;; MINGW*) mingw=true;; Darwin*) darwin=true if [ -z "$JAVA_VERSION" ] ; then JAVA_VERSION="MajorVersion" fi ;; esac [ -n "$JAVA_HOME" ] && export PATH="$JAVA_HOME/bin:$PATH" if [ -z "$JAVA_HOME" ] ; then if $darwin ; then if [ -z "$JAVA_VERSION" ] ; then JAVA_VERSION="MajorVersion" fi JAVA_HOME=$(/usr/libexec/java_home -v "$JAVA_VERSION") if [ $? -ne 0 ] ; then echo "Unable to find Java version: $JAVA_VERSION" >&2 exit 1 fi else JAVA_HOME=$(which java 2>/dev/null) if [ -z "$JAVA_HOME" ] ; then echo "Error: JAVA_HOME not found in your environment." >&2 echo "Please set the JAVA_HOME variable in your environment to match the" >&2 echo "location of your Java installation." >&2 exit 1 fi JAVA_HOME=$(dirname "$(dirname "$JAVA_HOME")") fi fi # For Cygwin, ensure paths are in UNIX format if $cygwin ; then [ -n "$JAVA_HOME" ] && JAVA_HOME=$(cygpath --unix "$JAVA_HOME") [ -n "$CLASSPATH" ] && CLASSPATH=$(cygpath --path --unix "$CLASSPATH") fi # For Mingw, ensure paths are in UNIX format if $mingw ; then [ -n "$JAVA_HOME" ] && JAVA_HOME="$(cd "$JAVA_HOME" && pwd)" fi # shellcheck disable=SC2034 MAVEN_PROJECTBASEDIR="${MAVEN_BASEDIR:-$(cd "$(dirname "$0")" && pwd)}" MAVEN_CMD_LINE_ARGS="$@" # shellcheck disable=SC2086 MAVEN_OPTS="${MAVEN_OPTS:--Xmx512m} $([ -f "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config" ] && cat "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config")" # 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 $@" WRAPPER_JAR="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain if [ -f "$WRAPPER_JAR" ]; then if [ "$MVNW_VERBOSE" = true ]; then echo "Found $WRAPPER_JAR" fi else if [ "$MVNW_VERBOSE" = true ]; then echo "Couldn't find $WRAPPER_JAR, downloading it ..." fi WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.3.2/maven-wrapper-3.3.2.jar" if [ -n "$MVNW_REPOURL" ]; then WRAPPER_URL="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.3.2/maven-wrapper-3.3.2.jar" fi if command -v curl > /dev/null 2>&1; then curl -o "$WRAPPER_JAR" "$WRAPPER_URL" elif command -v wget > /dev/null 2>&1; then wget -O "$WRAPPER_JAR" "$WRAPPER_URL" else echo "Error: Unable to download $WRAPPER_URL" >&2 exit 1 fi fi # shellcheck disable=SC2086 exec "$JAVA_HOME/bin/java" \ $MAVEN_OPTS \ -classpath "$WRAPPER_JAR" \ "-Dmaven.multiModuleProjectDirectory=$MAVEN_PROJECTBASEDIR" \ $WRAPPER_LAUNCHER $MAVEN_CMD_LINE_ARGS