Tim Starling has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/284625

Change subject: Bundle dependencies in an "uber-jar"
......................................................................

Bundle dependencies in an "uber-jar"

There was no Debian package for Grizzly, and doing our own would have
been a significant amount of work, since it uses a lot of dependencies
that we don't directly need.

Change-Id: Iddbb6ca15745cacd7088173861a3b1ed0c4c5d89
---
M README.md
M pom.xml
2 files changed, 49 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/html5depurate 
refs/changes/25/284625/1

diff --git a/README.md b/README.md
index 9f14719..e2200ab 100644
--- a/README.md
+++ b/README.md
@@ -8,13 +8,15 @@
 * maven2
 * jsvc
 
-Compile with `mvn compile`. Then `mvn dependency:build-classpath` will display
-a classpath suitable for testing. Then the daemon can be started with something
-like:
+Compile and generate a .jar file by running `mvn package`.
+
+We use the "shade" plugin to bundle all dependencies. So to run it, you only
+need the generated .jar file in the class path. To start the server as a
+daemon, use something like:
 
 ```
 /usr/bin/jsvc \
-       -cp "$classpath":target/classes \
+       -cp $(pwd)/target/html5depurate-1.0-SNAPSHOT.jar \
        -pidfile /tmp/html5depurate.pid \
        -errfile /tmp/html5depurate.err \
        -outfile /tmp/html5depurate.out \
@@ -53,8 +55,10 @@
   - A SysV init script wrapping jsvc should be fairly simple.
   - Very strong security guarantees are possible by using a security.policy
     file.
-  - Most Maven dependencies are packaged already, with the exception of the
-    validator.nu parser itself, which needs to be bundled.
+  - There is no package for grizzly, so we will have to bundle it for now.
+    Using Maven Central during build, instead of creating about 9 new Debian
+    source packages, is not allowed in Debian upstream, but WMF can distribute
+    the resulting file.
 
 * Collect warnings/errors and provide a JSON serialized return format
   exposed at /info.
diff --git a/pom.xml b/pom.xml
index e726baa..05e6a80 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,36 +7,69 @@
   <version>1.0-SNAPSHOT</version>
   <name>html5depurate</name>
   <url>http://maven.apache.org</url>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-shade-plugin</artifactId>
+        <version>2.4.3</version>
+        <configuration>
+        </configuration>
+        <executions>
+          <execution>
+            <phase>package</phase>
+            <goals>
+              <goal>shade</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
   <dependencies>
     <dependency>
       <groupId>nu.validator</groupId>
       <artifactId>htmlparser</artifactId>
-      <version>1.4.1</version>
+      <version>${htmlparser.version}</version>
     </dependency>
     <dependency>
       <groupId>commons-daemon</groupId>
       <artifactId>commons-daemon</artifactId>
-      <version>1.0.15</version>
+      <version>${commons-daemon.version}</version>
     </dependency>
     <dependency>
       <groupId>commons-cli</groupId>
       <artifactId>commons-cli</artifactId>
-      <version>1.3.1</version>
+      <version>${commons-cli.version}</version>
     </dependency>
     <dependency>
       <groupId>org.glassfish.grizzly</groupId>
       <artifactId>grizzly-framework</artifactId>
-      <version>2.3.22</version>
+      <version>${grizzly.version}</version>
     </dependency>
     <dependency>
       <groupId>org.glassfish.grizzly</groupId>
       <artifactId>grizzly-http-server</artifactId>
-      <version>2.3.22</version>
+      <version>${grizzly.version}</version>
     </dependency>
     <dependency>
       <groupId>org.glassfish.grizzly</groupId>
       <artifactId>grizzly-http-server-multipart</artifactId>
-      <version>2.3.22</version>
+      <version>${grizzly.version}</version>
     </dependency>
   </dependencies>
+  <properties>
+    <!--
+      Properties are used to define versions per the recommendation in
+      https://wiki.debian.org/Java/MavenRepoSpec
+
+      These are generally the latest versions available in Maven at the time of
+      development. All these packages have fairly stable APIs, so different
+      versions can be substituted.
+    -->
+    <htmlparser.version>1.4.1</htmlparser.version>
+    <commons-daemon.version>1.0.15</commons-daemon.version>
+    <commons-cli.version>1.3.1</commons-cli.version>
+    <grizzly.version>2.3.22</grizzly.version>
+  </properties>
 </project>

-- 
To view, visit https://gerrit.wikimedia.org/r/284625
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iddbb6ca15745cacd7088173861a3b1ed0c4c5d89
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/html5depurate
Gerrit-Branch: master
Gerrit-Owner: Tim Starling <tstarl...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to