-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sh
executable file
·39 lines (29 loc) · 1.27 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
#!/bin/bash
# This script builds two .war artifacts for production and test respectively.
#
# Prerequisites:
# * Java: Successfully built with: java-11-openjdk.
# * Apache Maven: Successfully built with Apache Maven: 3.9.9.
# * Make sure the user running the build can write in '/var/log/gazetteeer'.
# * Make sure that the `gazetteer-configs` directory is put next to the `gazetteer` repository directory.
#
# The results of this script will be copied to `./builds/<date the script was run>/`.
set -e
DIST_DIR=./builds
CONFIG_DIR=../gazetteer-configs
TODAY=$(date '+%Y-%m-%d')
mkdir -p $DIST_DIR/$TODAY
mkdir -p /var/log/gazetteer
cp $CONFIG_DIR/mail.properties src/main/webapp/WEB-INF/mail.properties
# Production build
cp $CONFIG_DIR/log4j2.xml.prod src/main/resources/log4j2.xml
cp $CONFIG_DIR/config.properties.prod src/main/webapp/WEB-INF/config.properties
cp $CONFIG_DIR/web.xml.prod src/main/webapp/WEB-INF/web.xml
mvn clean package
cp -r target/gazetteer.war $DIST_DIR/$TODAY/gazetteer.war
# Test build
cp $CONFIG_DIR/log4j2.xml.test src/main/resources/log4j2.xml
cp $CONFIG_DIR/config.properties.test src/main/webapp/WEB-INF/config.properties
cp $CONFIG_DIR/web.xml.test src/main/webapp/WEB-INF/web.xml
mvn clean package
cp -r target/gazetteer.war $DIST_DIR/$TODAY/gazetteer-test.war