summaryrefslogtreecommitdiffstats
path: root/to_jetty.sh
blob: fa6023e175845acdc1c7e5c133718e49cbd610c4 (plain)
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
#!/bin/sh

# Builds and deploys into Jetty; primarily for debugging

jetty=$1
fast=$2
if [ -z "$jetty" ]
then
	echo >&2 "usage: $0 jettydir [--fast]"
	exit 1
fi
if ! [ -f "$jetty/etc/jetty.xml" ]
then
	echo >&2 "error: $jetty is not a Jetty installation"
	exit 1
fi

ctx="$jetty/contexts/gerrit.xml" &&

if [ -f "$ctx" -a -n "$fast" ]
then
	echo >&2 "warning: Using fast mode to build only GWT..."
	echo >&2
	(cd appjar && mvn install) &&
	(cd appwar && mvn package) &&
	cp appwar/target/gerrit-*.war "$jetty/webapps/gerrit.war" &&
	touch "$ctx"
else
	(cd appdist && mvn clean install) &&
	out=$(cd appdist/target/gerrit-*-bin.dir/gerrit-* && pwd) &&

	cp $out/www/gerrit-*.war "$jetty/webapps/gerrit.war" &&
	if [ -f "$ctx" ]
	then
		touch "$ctx"
	else
		cp $out/jdbc/c3p0-*.jar "$jetty/lib/plus" &&
		cp $out/jdbc/postgresql-*jdbc*.jar "$jetty/lib/plus" &&

		rm -f "$jetty/contexts/test.xml" &&
		cp $out/www/jetty_gerrit.xml "$ctx" &&

		echo >&2 &&
		echo >&2 "You need to edit and configure $ctx"
	fi
fi