Files

83 lines
2.1 KiB
Bash
Raw Permalink Normal View History

2026-09-09 22:05:00 +08:00
#!/bin/sh
#
# Copyright 2002-2019 the original author or authors.
#
# Licensed 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
#
# https://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.
##############################################################################
#
# Maven Start Up Batch script
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
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
APP_HOME=$(cd "$(dirname "$PRG")" > /dev/null; pwd)
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support.
cygwin=false
msys=false
darwin=false
nonstop=false
case "$(uname)" in
CYGWIN*) cygwin=true ;;
Darwin*) darwin=true ;;
MSYS* | MINGW*) msys=true ;;
NONSTOP*) nonstop=true ;;
esac
# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin; then
[ -n "$MAVEN_HOME" ] && MAVEN_HOME=$(cygpath --unix "$MAVEN_HOME")
[ -n "$CLASSPATH" ] && CLASSPATH=$(cygpath --path --unix "$CLASSPATH")
fi
# Attempt to find MAVEN_HOME
if [ -z "$MAVEN_HOME" ]; then
MAVEN_HOME=/usr/local/maven
fi
if [ -e "$MAVEN_HOME/bin/mvn" ]; then
exec "$MAVEN_HOME/bin/mvn" "$@"
elif [ -x /usr/bin/mvn ]; then
exec /usr/bin/mvn "$@"
elif [ -x /usr/local/bin/mvn ]; then
exec /usr/local/bin/mvn "$@"
else
die "ERROR: Could not find Maven installation. Please install Maven or set JAVA_HOME and MAVEN_HOME."
fi