Overhaul our build system to only create a WAR file

We're a web application.  There is no reason to create anything else
other than a single stand-alone WAR file out of our build.  Using the
appjar, appdist, devdb projects all in the same repository is chaos
and difficult to maintain.

The Hudson continuous integration project has their entire WAR file
as a self-contained application, which can be run directly off the
command line with "java -jar hudson.war".  This is rather nice, as
it makes it a lot easier for users to run the application code that
comes along with the web application.

This change moves everything into a single WAR file, and thus can
cut our overall download by 6 MB by reducing the copies of each
dependency JAR down from 2 (one in the .tar.bz2, one in the WAR
embedded in the .tar.bz2) to only 1 (the one in the WAR itself).

Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
Shawn O. Pearce
2009-02-02 15:39:12 -08:00
parent 38272d5d82
commit b8527eab37
26 changed files with 262 additions and 944 deletions

View File

@@ -19,9 +19,8 @@ the downloads page at the project site:
* http://code.google.com/p/gerrit/downloads/list[Gerrit Downloads]
Download a `*.bin.tar.bz2` package and untar it locally with
`tar jtf gerrit-2.0.bin.tar.bz2` (or whatever the downloaded
file was).
Download any current `*.war` package.
Building Gerrit From Source
---------------------------
@@ -37,18 +36,17 @@ Maven from a source download obtained directly from Git:
(cd jgit/jgit-maven/jgit && mvn install)
(cd mina_sshd && mvn install)
cd appdist
mvn clean install
cd target/gerrit-*-bin.dir/gerrit-*
(cd appjar && mvn clean package)
cp appjar/target/gerrit-*.war ...YOUR.DEST.../gerrit.war
====
The first build may take a while as dependencies are searched
for and downloaded from Maven distribution repositories.
Unfortunately you need to install to your local Maven repository
(typically under `~/.m2`) in order to fully build all of the source
based dependencies. Some core dependencies for Gerrit are still
under active development and have not made final releases yet.
Unfortunately you need to install snapshots of both JGit and MINA
SSHD to your local Maven repository (typically under `~/.m2`).
These core dependencies are still under active development and have
not made final releases yet.
Apache Maven:
@@ -85,12 +83,13 @@ Initialize the Schema
Create the Gerrit 2 Tables
~~~~~~~~~~~~~~~~~~~~~~~~~~
Either run CreateSchema from the command line (requires writing
a `GerritServer.properties`, see `GerritServer.properties_example`
under `devdb/src/main/config`):
Either run CreateSchema from the command line:
====
bin/gerrit2.sh --config=GerritServer.properties CreateSchema
java -jar gerrit.war --cat extra/GerritServer.properties_example >GerritServer.properties
edit GerritServer.properties
java -jar gerrit.war CreateSchema
====
Or, run the application once in a container to force it to initialize
@@ -108,7 +107,7 @@ can avoid table scans when looking up information. Run the
e.g. with PostgreSQL:
====
psql -f sql/query_index.sql reviewdb
java -jar gerrit.war --cat sql/query_index.sql | psql reviewdb
====
Configure site_path
@@ -185,12 +184,17 @@ call the unpacked directory `$JETTY_HOME`.
* http://dist.codehaus.org/jetty/[Jetty Downloads]
Install the JDBC drivers, using either the ones that come embedded
with Gerrit, or by downloading them yourself from their mirrors:
====
java -jar gerrit.war --cat lib/c3p0-0.9.1.2.jar >$JETTY_HOME/lib/plus/c3p0-0.9.1.2.jar
java -jar gerrit.war --cat lib/postgresql-8.3-603.jdbc3.jar >$JETTY_HOME/lib/plus/postgresql-8.3-603.jdbc3.jar
====
Copy Gerrit into the deployment:
====
cp jdbc/c3p0-*.jar $JETTY_HOME/lib/plus/
cp jdbc/postgresql-*.jdbc*.jar $JETTY_HOME/lib/plus/
cp www/jetty_gerrit.xml $JETTY_HOME/contexts/gerrit.xml
cp www/gerrit-*.war $JETTY_HOME/webapps/gerrit.war
java -jar gerrit.war --cat extra/jetty_gerrit.xml >$JETTY_HOME/contexts/gerrit.xml
cp gerrit.war $JETTY_HOME/webapps/gerrit.war
rm -f $JETTY_HOME/context/test.xml
====
@@ -232,7 +236,7 @@ Under Jetty, restarting the web application (e.g. after modifying
Other Servlet Containers
~~~~~~~~~~~~~~~~~~~~~~~~
Deploy the `www/gerrit-*.war` file to your application server as
Deploy the `gerrit-*.war` file to your application server as
`gerrit.war`.
Configure the JNDI DataSource `jdbc/ReviewDb` for the Gerrit web