Lines 2-27
Link Here
|
2 |
|
2 |
|
3 |
set -e |
3 |
set -e |
4 |
|
4 |
|
5 |
if [ -f "%%PREFIX%%/etc/maven/setenv.sh" ] ; then |
5 |
SCRIPT_NAME="$(basename $0)" |
6 |
. "%%PREFIX%%/etc/maven/setenv.sh" |
|
|
7 |
fi |
8 |
|
6 |
|
9 |
if [ -z "${M2_HOME}" ] ; then |
7 |
if [ -z "${MAVEN_HOME}" ] ; then |
10 |
INSTANCES_DIRECTORY="/usr/local/etc/maven-wrapper/instances.d" |
8 |
INSTANCES_DIRECTORY="%%ETCDIR%%/instances.d" |
11 |
INSTANCE="`%%FIND%% -s "${INSTANCES_DIRECTORY}" -type f -mindepth 1 -maxdepth 1 | %%TAIL%% -n 1`" |
9 |
INSTANCE="$(%%FIND%% -s "${INSTANCES_DIRECTORY}" -type f -mindepth 1 -maxdepth 1 | %%TAIL%% -n 1)" |
12 |
|
10 |
|
13 |
if [ -z "${INSTANCE}" ] ; then |
11 |
if [ -z "${INSTANCE}" ] ; then |
14 |
echo "could not find a Maven instance! (${INSTANCES_DIRECTORY})" >&2 |
12 |
echo "Could not find a Maven instance in ${INSTANCES_DIRECTORY}" >&2 |
15 |
exit 1 |
13 |
exit 1 |
16 |
fi |
14 |
fi |
17 |
|
15 |
|
18 |
M2_HOME="`%%CAT%% "${INSTANCE}"`" |
16 |
MAVEN_HOME="$(%%CAT%% "${INSTANCE}")" |
19 |
|
17 |
|
20 |
if [ ! -d "${M2_HOME}" ] ; then |
18 |
if [ ! -d "${MAVEN_HOME}" ] ; then |
21 |
echo "not a directory: ${M2_HOME}" >&2 |
19 |
echo "Not a directory: ${MAVEN_HOME}" >&2 |
22 |
exit 2 |
20 |
exit 2 |
23 |
fi |
21 |
fi |
24 |
fi |
22 |
fi |
25 |
|
23 |
|
26 |
export M2_HOME |
24 |
exec "${MAVEN_HOME}/bin/${SCRIPT_NAME}" "$@" |
27 |
exec "${M2_HOME}/bin/mvn" "$@" |
|
|