Add scripts for building and installing war.
[online-glom:gwt-glom.git] / utils / build-onlineglom-war.sh
1 #!/bin/bash
2 #
3 # Script to build the OnlineGlom.war file.
4 #
5
6 # confirm that we're in the right dir
7 lastdir=$(pwd | sed -e "s|/| |g" | awk '{print $NF}')
8 if [ $lastdir != "gwt-glom" ]; then
9   scriptname=$(echo $0 | sed -e "s|^\./||")
10   echo $scriptname":"
11   echo "   Please run this script from the gwt-glom directory with this command:"
12   echo "   ./utils/"$scriptname
13   exit 1
14 fi
15
16
17 echo "Removing generated files ... "
18
19 rm --interactive=never -rfv src/main/webapp/WEB-INF/classes/* \
20                             src/main/webapp/WEB-INF/lib/* \
21                             src/main/webapp/WEB-INF/deploy/* \
22                             src/main/webapp/OnlineGlom/* \
23                             src/main/webapp/logs/* \
24                             target/* target/.generated
25
26 echo "done"
27
28 echo "Building and creating OnlineGlom.war. This can take a couple of minutes ... "
29
30 mvn clean package
31
32 if [ $? -ne 0 -o ! -f target/gwt-glom-1.0-SNAPSHOT.war ]; then
33   echo "Error building OnlineGlom."
34   exit 1
35 fi
36
37 mv target/{gwt-glom-1.0-SNAPSHOT,OnlineGlom}.war
38
39 echo "done"
40
41 echo "The deployable war can be found here:"
42 echo ""
43 echo "   ./target/OnlineGlom.war"
44 echo ""
45 echo "You can scp or sftp it to your server for deployment."