Skip to content

Commit 9251d9f

Browse files
authored
Add files via upload
1 parent fba4767 commit 9251d9f

File tree

14 files changed

+697
-0
lines changed

14 files changed

+697
-0
lines changed

m2.conf

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
main is org.apache.maven.cli.MavenCli from plexus.core
2+
3+
set maven.conf default ${maven.home}/conf
4+
5+
[plexus.core]
6+
load ${maven.conf}/logging
7+
optionally ${maven.home}/lib/ext/*.jar
8+
load ${maven.home}/lib/*.jar

mvn

+199
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
#!/bin/sh
2+
3+
# Licensed to the Apache Software Foundation (ASF) under one
4+
# or more contributor license agreements. See the NOTICE file
5+
# distributed with this work for additional information
6+
# regarding copyright ownership. The ASF licenses this file
7+
# to you under the Apache License, Version 2.0 (the
8+
# "License"); you may not use this file except in compliance
9+
# with the License. You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing,
14+
# software distributed under the License is distributed on an
15+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
# KIND, either express or implied. See the License for the
17+
# specific language governing permissions and limitations
18+
# under the License.
19+
20+
# -----------------------------------------------------------------------------
21+
# Apache Maven Startup Script
22+
#
23+
# Environment Variable Prerequisites
24+
#
25+
# JAVA_HOME Must point at your Java Development Kit installation.
26+
# MAVEN_OPTS (Optional) Java runtime options used when Maven is executed.
27+
# MAVEN_SKIP_RC (Optional) Flag to disable loading of mavenrc files.
28+
# -----------------------------------------------------------------------------
29+
30+
if [ -z "$MAVEN_SKIP_RC" ] ; then
31+
32+
if [ -f /etc/mavenrc ] ; then
33+
. /etc/mavenrc
34+
fi
35+
36+
if [ -f "$HOME/.mavenrc" ] ; then
37+
. "$HOME/.mavenrc"
38+
fi
39+
40+
fi
41+
42+
# OS specific support. $var _must_ be set to either true or false.
43+
cygwin=false;
44+
mingw=false;
45+
case "`uname`" in
46+
CYGWIN*) cygwin=true;;
47+
MINGW*) mingw=true;;
48+
esac
49+
50+
## resolve links - $0 may be a link to Maven's home
51+
PRG="$0"
52+
53+
# need this for relative symlinks
54+
while [ -h "$PRG" ] ; do
55+
ls=`ls -ld "$PRG"`
56+
link=`expr "$ls" : '.*-> \(.*\)$'`
57+
if expr "$link" : '/.*' > /dev/null; then
58+
PRG="$link"
59+
else
60+
PRG="`dirname "$PRG"`/$link"
61+
fi
62+
done
63+
64+
saveddir=`pwd`
65+
66+
MAVEN_HOME=`dirname "$PRG"`/..
67+
68+
# make it fully qualified
69+
MAVEN_HOME=`cd "$MAVEN_HOME" && pwd`
70+
71+
cd "$saveddir"
72+
73+
# For Cygwin, ensure paths are in Unix format before anything is touched
74+
if $cygwin ; then
75+
[ -n "$MAVEN_HOME" ] &&
76+
MAVEN_HOME=`cygpath --unix "$MAVEN_HOME"`
77+
[ -n "$JAVA_HOME" ] &&
78+
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
79+
[ -n "$CLASSPATH" ] &&
80+
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
81+
fi
82+
83+
# For MinGW, ensure paths are in Unix format before anything is touched
84+
if $mingw ; then
85+
[ -n "$MAVEN_HOME" ] &&
86+
MAVEN_HOME=`(cd "$MAVEN_HOME"; pwd)`
87+
[ -n "$JAVA_HOME" ] &&
88+
JAVA_HOME=`(cd "$JAVA_HOME"; pwd)`
89+
# TODO classpath?
90+
fi
91+
92+
if [ -z "$JAVA_HOME" ] ; then
93+
JAVACMD=`which java`
94+
else
95+
JAVACMD="$JAVA_HOME/bin/java"
96+
fi
97+
98+
if [ ! -x "$JAVACMD" ] ; then
99+
echo "The JAVA_HOME environment variable is not defined correctly" >&2
100+
echo "This environment variable is needed to run this program" >&2
101+
echo "NB: JAVA_HOME should point to a JDK not a JRE" >&2
102+
exit 1
103+
fi
104+
105+
CLASSWORLDS_JAR=`echo "${MAVEN_HOME}"/boot/plexus-classworlds-*.jar`
106+
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
107+
108+
# For Cygwin, switch paths to Windows format before running java
109+
if $cygwin ; then
110+
[ -n "$MAVEN_HOME" ] &&
111+
MAVEN_HOME=`cygpath --path --windows "$MAVEN_HOME"`
112+
[ -n "$JAVA_HOME" ] &&
113+
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
114+
[ -n "$CLASSPATH" ] &&
115+
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
116+
[ -n "$CLASSWORLDS_JAR" ] &&
117+
CLASSWORLDS_JAR=`cygpath --path --windows "$CLASSWORLDS_JAR"`
118+
fi
119+
120+
# traverses directory structure from process work directory to filesystem root
121+
# first directory with .mvn subdirectory is considered project base directory
122+
find_maven_basedir() {
123+
(
124+
basedir=`find_file_argument_basedir "$@"`
125+
wdir="${basedir}"
126+
while [ "$wdir" != '/' ] ; do
127+
if [ -d "$wdir"/.mvn ] ; then
128+
basedir=$wdir
129+
break
130+
fi
131+
wdir=`cd "$wdir/.."; pwd`
132+
done
133+
echo "${basedir}"
134+
)
135+
}
136+
137+
find_file_argument_basedir() {
138+
(
139+
basedir=`pwd`
140+
141+
found_file_switch=0
142+
for arg in "$@"; do
143+
if [ ${found_file_switch} -eq 1 ]; then
144+
if [ -d "${arg}" ]; then
145+
basedir=`cd "${arg}" && pwd -P`
146+
elif [ -f "${arg}" ]; then
147+
basedir=`dirname "${arg}"`
148+
basedir=`cd "${basedir}" && pwd -P`
149+
if [ ! -d "${basedir}" ]; then
150+
echo "Directory ${basedir} extracted from the -f/--file command-line argument ${arg} does not exist" >&2
151+
exit 1
152+
fi
153+
else
154+
echo "POM file ${arg} specified with the -f/--file command line argument does not exist" >&2
155+
exit 1
156+
fi
157+
break
158+
fi
159+
if [ "$arg" = "-f" -o "$arg" = "--file" ]; then
160+
found_file_switch=1
161+
fi
162+
done
163+
echo "${basedir}"
164+
)
165+
}
166+
167+
# concatenates all lines of a file
168+
concat_lines() {
169+
if [ -f "$1" ]; then
170+
echo "`tr -s '\r\n' ' ' < "$1"`"
171+
fi
172+
}
173+
174+
MAVEN_PROJECTBASEDIR="${MAVEN_BASEDIR:-`find_maven_basedir "$@"`}"
175+
MAVEN_OPTS="`concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config"` $MAVEN_OPTS"
176+
177+
# For Cygwin, switch project base directory path to Windows format before
178+
# executing Maven otherwise this will cause Maven not to consider it.
179+
if $cygwin ; then
180+
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
181+
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
182+
fi
183+
184+
export MAVEN_PROJECTBASEDIR
185+
186+
# Provide a "standardized" way to retrieve the CLI args that will
187+
# work with both Windows and non-Windows executions.
188+
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
189+
export MAVEN_CMD_LINE_ARGS
190+
191+
exec "$JAVACMD" \
192+
$MAVEN_OPTS \
193+
$MAVEN_DEBUG_OPTS \
194+
-classpath "${CLASSWORLDS_JAR}" \
195+
"-Dclassworlds.conf=${MAVEN_HOME}/bin/m2.conf" \
196+
"-Dmaven.home=${MAVEN_HOME}" \
197+
"-Dlibrary.jansi.path=${MAVEN_HOME}/lib/jansi-native" \
198+
"-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
199+
${CLASSWORLDS_LAUNCHER} "$@"

0 commit comments

Comments
 (0)