-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.sh
executable file
·39 lines (36 loc) · 1.01 KB
/
build.sh
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
if [[ -z ${JAVA_HOME} ]]; then
echo "JAVA_HOME is not set"
exit 1
fi
jdk_version() {
local result
local java_cmd=$JAVA_HOME/bin/java
local IFS=$'\n'
# remove \r for Cygwin
local lines=$("$java_cmd" -Xms32M -Xmx32M -version 2>&1 | tr '\r' '\n')
if [[ -z $java_cmd ]]
then
result=no_java
else
for line in $lines; do
if [[ (-z $result) && ($line = *"version \""*) ]]
then
local ver=$(echo $line | sed -e 's/.*version "\(.*\)"\(.*\)/\1/; 1q')
# on macOS, sed doesn't support '?'
if [[ $ver = "1."* ]]
then
result=$(echo $ver | sed -e 's/1\.\([0-9]*\)\(.*\)/\1/; 1q')
else
result=$(echo $ver | sed -e 's/\([0-9]*\)\(.*\)/\1/; 1q')
fi
fi
done
fi
echo "$result"
}
JAVA_VERSION=$(jdk_version)
if [[ "$JAVA_VERSION" -ne "11" ]]; then
echo "must use jdk11 to compile"
exit 1
fi
mvn package