-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sh
executable file
·34 lines (27 loc) · 1.11 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
#!/bin/bash
ERROR="\033[0;31m"
INFO="\033[0;34m"
SUCCESS="\033[0;32m"
if [ -d "dist" ]; then
rm -rf dist
fi
echo -e "############ Generating the build (compile and package). ############ "
mvn clean package
CMD_MVN_PACKAGE=$?
if [ $CMD_MVN_PACKAGE -ne 0 ] ; then
echo -e "$ERROR*****************************************************************************"
echo -e "$ERROR###### BUILD FAILURE: an error occurred in the build of the project :( ######"
echo -e "$ERROR*****************************************************************************"
exit $CMD_MVN_PACKAGE
fi
mkdir dist
CURRENT_DIR=$(pwd)
DIR_JAR_FILE=$(ls $CURRENT_DIR/target/*jar)
JAR_BUILD=$(echo $DIR_JAR_FILE | rev | cut -f1 -d'/' | rev)
echo -e "$INFO############ Moving generated artifact to the dist directory. ############ "
mv target/$JAR_BUILD dist
echo
echo -e "$SUCCESS****************************************************************************"
echo -e "$SUCCESS###### Build completed successfully!!!! ######"
echo -e "$SUCCESS****************************************************************************"
echo