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>
diff --git a/appjar/pom.xml b/appjar/pom.xml index c8b7d10..cb2a72e 100644 --- a/appjar/pom.xml +++ b/appjar/pom.xml
@@ -20,7 +20,7 @@ <modelVersion>4.0.0</modelVersion> <groupId>gerrit</groupId> <artifactId>gerrit-appjar</artifactId> - <packaging>jar</packaging> + <packaging>war</packaging> <version>2.0.1-SNAPSHOT</version> <name>gerrit-appjar</name> <description>Gerrit - Web Based Code Review</description> @@ -281,6 +281,70 @@ </plugin> <plugin> + <groupId>com.totsp.gwt</groupId> + <artifactId>maven-googlewebtoolkit2-plugin</artifactId> + <version>2.0-beta26</version> + <configuration> + <compileTargets> + <value>com.google.gerrit.Gerrit</value> + </compileTargets> + <runTarget>com.google.gerrit.Gerrit/Gerrit.html</runTarget> + <noServer>false</noServer> + <extraJvmArgs>-Xmx512m</extraJvmArgs> + <gwtVersion>${gwtVersion}</gwtVersion> + </configuration> + <executions> + <execution> + <goals> + <goal>compile</goal> + </goals> + </execution> + </executions> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-war-plugin</artifactId> + <configuration> + <warSourceExcludes>.gwt-tmp/**</warSourceExcludes> + <archiveClasses>true</archiveClasses> + <archive> + <manifest> + <mainClass>ExecutableWarMain</mainClass> + </manifest> + <manifestEntries> + <Executable-War-Package>com.google.gerrit.pgm</Executable-War-Package> + </manifestEntries> + </archive> + </configuration> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <id>make-executable</id> + <phase>generate-resources</phase> + <goals> + <goal>unpack</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>gerrit</groupId> + <artifactId>executablewar</artifactId> + <overWrite>true</overWrite> + <outputDirectory>${project.build.directory}/executablewar</outputDirectory> + <includes>**/*.class</includes> + </artifactItem> + </artifactItems> + </configuration> + </execution> + </executions> + </plugin> + + <plugin> <artifactId>maven-antrun-plugin</artifactId> <executions> <execution> @@ -300,6 +364,47 @@ <goal>run</goal> </goals> </execution> + + <execution> + <id>fix-output</id> + <phase>process-classes</phase> + <configuration> + <tasks> + <property name="d" location="${basedir}/target/${project.name}-${project.version}"/> + + <copy todir="${d}"> + <fileset dir="${basedir}/target/executablewar" includes="**/*"/> + </copy> + + <copy todir="${d}/WEB-INF/extra"> + <fileset dir="${basedir}/src/main/java"> + <include name="GerritServer.properties_example"/> + </fileset> + </copy> + + <move todir="${d}"> + <fileset dir="${d}/com.google.gerrit.Gerrit"> + <exclude name="Gerrit.html" /> + <exclude name="SetCookie.html" /> + <exclude name="hosted.html" /> + </fileset> + </move> + <delete dir="${d}/com.google.gerrit.Gerrit" /> + <apply executable="gzip" addsourcefile="false"> + <arg value="-9"/> + <fileset dir="${d}" + includes="**/*.html,**/*.css"/> + <redirector> + <inputmapper type="glob" from="*" to="${d}/*"/> + <outputmapper type="glob" from="*" to="${d}/*.gz"/> + </redirector> + </apply> + </tasks> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> </executions> </plugin> </plugins> @@ -307,13 +412,6 @@ <dependencies> <dependency> - <groupId>gerrit</groupId> - <artifactId>gerrit-devdb</artifactId> - <version>2.0.1-SNAPSHOT</version> - <scope>test</scope> - </dependency> - - <dependency> <groupId>gwtorm</groupId> <artifactId>gwtorm</artifactId> <version>1.0.1</version> @@ -328,6 +426,13 @@ </dependency> <dependency> + <groupId>gerrit</groupId> + <artifactId>executablewar</artifactId> + <version>1.0</version> + <scope>provided</scope> + </dependency> + + <dependency> <groupId>com.dyuproject</groupId> <artifactId>dyuproject-openid</artifactId> <version>1.1.1</version> @@ -369,6 +474,27 @@ <scope>compile</scope> </dependency> + <dependency> + <groupId>postgresql</groupId> + <artifactId>postgresql</artifactId> + <version>8.3-603.jdbc3</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>com.h2database</groupId> + <artifactId>h2</artifactId> + <version>1.1.106</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>c3p0</groupId> + <artifactId>c3p0</artifactId> + <version>0.9.1.2</version> + <scope>runtime</scope> + </dependency> + <!-- GWT --> <dependency> <groupId>com.google.gwt</groupId>