-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.sh
executable file
·54 lines (42 loc) · 1.13 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
if [ $# -lt 0 ]; then
echo Please use the following format:
echo "$0 <MVN action: clean, jar, site>"
exit 1
fi
START=`date +%s`
function clean {
LOGS_ARRAY=(`find ./ -maxdepth 1 -name "*.log"`)
mvn clean
for dir in `find . -maxdepth 1 -type d`
do
if [ -d "${dir}/target/" ]; then
rm -rf ${dir}/target/
fi
done
if [ ${#LOGS_ARRAY[@]} -gt 0 ]; then
rm *.log
fi
if [ -d "./logs/" ]; then
rm -rf ./logs/
fi
}
ACTION="${1}"
if [ -z "${1}" ] ; then
ACTION="clean"
fi
if [ "$ACTION" == "clean" ]; then
clean
elif [ "$ACTION" == "jar" ]; then
clean
mvn -Dmaven.test.skip=true package
elif [ "$ACTION" == "site" ]; then
clean
mvn -Dmaven.test.skip=true site
fi
RUNTIME=$((`date +%s` - START))
echo "[INFO] ------------------------------------------------------------------------"
echo "[INFO] BUILD SUCCESS"
echo "[INFO] ------------------------------------------------------------------------"
echo "[INFO] Total time taken: ${RUNTIME} s"
echo "[INFO] ------------------------------------------------------------------------"