2010-12-03 14:38:46 +00:00
|
|
|
#!/bin/sh
|
2013-12-23 09:40:37 +00:00
|
|
|
|
2016-08-08 05:50:14 +00:00
|
|
|
for f in /etc/mavenrc /etc/java/maven.conf "$HOME/.mavenrc"; do
|
|
|
|
[ -f "$f" ] && . "$f"
|
|
|
|
done
|
2013-12-23 09:40:37 +00:00
|
|
|
|
2010-12-03 14:38:46 +00:00
|
|
|
if [ -f /usr/share/java-utils/java-functions ] ; then
|
|
|
|
. /usr/share/java-utils/java-functions
|
|
|
|
set_jvm
|
|
|
|
set_javacmd
|
|
|
|
fi
|
2016-08-08 05:50:14 +00:00
|
|
|
export JAVA_HOME
|
|
|
|
export JAVACMD
|
2010-12-03 14:38:46 +00:00
|
|
|
|
2013-03-12 12:27:04 +00:00
|
|
|
export M2_HOME="${M2_HOME:-/usr/share/maven}"
|
2016-08-08 05:50:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
# traverses directory structure from process work directory to filesystem root
|
|
|
|
# first directory with .mvn subdirectory is considered project base directory
|
|
|
|
find_maven_basedir() {
|
|
|
|
(
|
|
|
|
basedir="`pwd`"
|
|
|
|
wdir="`pwd`"
|
|
|
|
while [ "$wdir" != '/' ] ; do
|
|
|
|
if [ -d "$wdir"/.mvn ] ; then
|
|
|
|
basedir=$wdir
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
wdir="`cd "$wdir/.."; pwd`"
|
|
|
|
done
|
|
|
|
echo "${basedir}"
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export MAVEN_PROJECTBASEDIR="${MAVEN_BASEDIR:-`find_maven_basedir`}"
|
|
|
|
|
|
|
|
export MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
|
|
|
|
|
|
|
|
project_opts=$(
|
|
|
|
[ -e "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config" ] &&
|
|
|
|
cat /tmp/foo "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config")
|
|
|
|
|
|
|
|
exec "$JAVACMD" \
|
|
|
|
$project_opts \
|
|
|
|
$MAVEN_OPTS \
|
|
|
|
$MAVEN_DEBUG_OPTS \
|
|
|
|
-classpath $(build-classpath plexus-classworlds) \
|
|
|
|
-Dclassworlds.conf="${M2_HOME}/bin/m2.conf" \
|
|
|
|
-Dmaven.home="${M2_HOME}" \
|
|
|
|
-Dmaven.multiModuleProjectDirectory="${MAVEN_PROJECTBASEDIR}" \
|
|
|
|
org.codehaus.plexus.classworlds.launcher.Launcher \
|
|
|
|
"$@"
|