travis,jenkins: Fail build if javac emits warnings
diff --git a/build.gradle b/build.gradle
index 8c8b647..e1f75db 100644
--- a/build.gradle
+++ b/build.gradle
@@ -32,6 +32,9 @@
     [compileJava, compileTestJava].each() {
         it.options.compilerArgs += ["-Xlint:all", "-Xlint:-options"]
         it.options.encoding = "UTF-8"
+        if (rootProject.hasProperty('failOnWarnings') && rootProject.failOnWarnings.toBoolean()) {
+            it.options.compilerArgs += ["-Werror"]
+        }
     }
 
     compileTestJava {