-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnmvn
More file actions
executable file
·76 lines (68 loc) · 1.69 KB
/
Copy pathnmvn
File metadata and controls
executable file
·76 lines (68 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/bash
# --- Resolve script directory (follow symlinks) ---
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
SCRIPT_DIR=$(cd "$(dirname "$PRG")" && pwd)
TARGET_DIR="$SCRIPT_DIR/apache-maven/target"
MAVEN_HOME="$TARGET_DIR/apache-maven-4.1.0-SNAPSHOT"
if [ ! -d "$MAVEN_HOME" ]; then
echo "Error: Maven home not found at $MAVEN_HOME"
echo "Run: ./build-nmvn.sh"
exit 1
fi
if [ -z "$JAVA_HOME" ]; then
echo "Error: JAVA_HOME is not set."
echo "Set it with: export JAVA_HOME=/path/to/jdk"
exit 1
fi
# --- Find project base directory (.mvn marker) ---
find_file_argument_basedir() {
local basedir
basedir=$(pwd)
local found_file_switch=0
for arg in "$@"; do
if [ $found_file_switch -eq 1 ]; then
if [ -d "$arg" ]; then
basedir=$(cd "$arg" && pwd -P)
elif [ -f "$arg" ]; then
basedir=$(cd "$(dirname "$arg")" && pwd -P)
fi
break
fi
if [ "$arg" = "-f" ] || [ "$arg" = "--file" ]; then
found_file_switch=1
fi
done
echo "$basedir"
}
find_maven_basedir() {
local basedir
basedir=$(find_file_argument_basedir "$@")
local wdir="$basedir"
while : ; do
if [ -d "$wdir/.mvn" ]; then
basedir="$wdir"
break
fi
if [ "$wdir" = "/" ]; then
break
fi
wdir=$(cd "$wdir/.." && pwd)
done
echo "$basedir"
}
MAVEN_PROJECTBASEDIR=$(find_maven_basedir "$@")
"$SCRIPT_DIR/nmvn-native" \
-Dguice_bytecode_gen_option=DISABLED \
-Djava.home="$JAVA_HOME" \
-Dmaven.home="$MAVEN_HOME" \
-Dmaven.multiModuleProjectDirectory="$MAVEN_PROJECTBASEDIR" \
"$@"