-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.sh
74 lines (62 loc) · 2.34 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
TOMCAT_HOME=/Users/michaelwechner/local/apache-tomcat-8.5.53
JAVA_VERSION_REQUIRED=11.0.11
#JAVA_VERSION_REQUIRED=11.0.16
# ----- Check for Java version
JAVA_HOME_MACOSX=/System/Library/Frameworks/JavaVM.framework/Home
JAVA_HOME_MACOSX_YOSEMITE=/System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java_home
JAVA_HOME_11=/Library/Java/JavaVirtualMachines/jdk-$JAVA_VERSION_REQUIRED.jdk/Contents/Home
JAVA_VERSION=$(java -version 2>&1 | awk -F '"' '/version/ {print $2}')
echo "Your Java version: $JAVA_VERSION"
if [ $JAVA_VERSION = $JAVA_VERSION_REQUIRED ];then
echo "Your Java version is correct :-)"
else
echo ""
echo "WARNING: Katie requires Java $JAVA_VERSION_REQUIRED, please make sure to install Java $JAVA_VERSION_REQUIRED and set JAVA_HOME accordingly"
echo ""
exit 1
fi
if [ -f $JAVA_HOME_MACOSX_YOSEMITE ]; then
if [ -d $JAVA_HOME_11 ];then
echo "INFO: Java is installed at $JAVA_HOME_11 :-)"
if [ "$JAVA_HOME" = "" ];then
echo "ERROR: No JAVA_HOME set! Please make sure to set JAVA_HOME: export JAVA_HOME=$JAVA_HOME_11"
exit 1
else
echo "INFO: JAVA_HOME is set to '$JAVA_HOME'"
fi
else
echo "ERROR: No such JAVA_HOME directory: $JAVA_HOME_11"
exit 1
fi
else
if [ $JAVA_VERSION = $JAVA_VERSION_REQUIRED ];then
echo "Operating system not detected, but Java version set correctly, so let us continue :-)"
else
echo ""
echo "WARNING: Operating system not detected."
echo "WARNING: Katie requires Java $JAVA_VERSION_REQUIRED, please make sure to install Java $JAVA_VERSION_REQUIRED and set JAVA_HOME accordingly"
echo ""
exit 1
fi
fi
echo "INFO: Clean ..."
mvn clean
echo "INFO: Build Katie webapp ..."
mvn install -Dmaven.test.skip=true
#mvn install
#mvn -X install
if [ -d $TOMCAT_HOME ];then
echo "INFO: Deploy webapp ..."
rm -rf $TOMCAT_HOME/webapps/katie
rm -rf $TOMCAT_HOME/work/Catalina/localhost/katie
cp target/askkatie-webapp-*.war $TOMCAT_HOME/webapps/katie.war
#rm -rf $TOMCAT_HOME/webapps/ROOT
#rm -rf $TOMCAT_HOME/work/Catalina/localhost/ROOT
#cp target/askkatie-webapp-*.war $TOMCAT_HOME/webapps/ROOT.war
echo "INFO: Clean log files ..."
rm -f $TOMCAT_HOME/logs/*
echo "INFO: Startup Tomcat '$TOMCAT_HOME' and access AskKatie 'http://127.0.0.1:8080/katie/' ...."
else
echo "INFO: No Tomcat installed at $TOMCAT_HOME"
fi