Remove maven support for instrumentation-java. (#166)

diff --git a/build.gradle b/build.gradle
index 5aea52c..089e841 100644
--- a/build.gradle
+++ b/build.gradle
@@ -7,6 +7,7 @@
         }
     }
     dependencies {
+        classpath 'ru.vyarus:gradle-animalsniffer-plugin:1.3.0'
         classpath 'net.ltgt.gradle:gradle-errorprone-plugin:0.0.9'
     }
 }
@@ -18,9 +19,14 @@
     apply plugin: 'java'
     apply plugin: "signing"
     apply plugin: "jacoco"
-    // TODO(bdrutu): enable all checks.
-    apply plugin: "net.ltgt.errorprone"
+    // The plugin only has an effect if a signature is specified
+    apply plugin: 'ru.vyarus.animalsniffer'
     apply plugin: 'findbugs'
+    // Plugins that require java8
+    if (JavaVersion.current().isJava8Compatible()) {
+        // TODO(bdrutu): enable all checks.
+        apply plugin: "net.ltgt.errorprone"
+    }
 
     group = "com.google.instrumentation"
     version = "0.4.0-SNAPSHOT" // CURRENT_INSTRUMENTATION_VERSION
@@ -36,7 +42,11 @@
     [compileJava, compileTestJava].each() {
         it.options.compilerArgs += ["-Xlint:all", "-Xlint:-try"]
         it.options.encoding = "UTF-8"
-        it.options.compilerArgs += ["-Werror"]
+        // TODO(bdrutu): Enable when fix the issue with configuring bootstrap class.
+        // [options] bootstrap class path not set in conjunction with -source 1.6
+        if (JavaVersion.current().isJava8Compatible()) {
+            it.options.compilerArgs += ["-Werror"]
+        }
     }
 
     compileTestJava {
@@ -89,9 +99,11 @@
                 libraries.mockito,
                 libraries.truth
 
-        // The ErrorProne plugin defaults to the latest, which would break our
-        // build if error prone releases a new version with a new check
-        errorprone 'com.google.errorprone:error_prone_core:2.0.19'
+        if (JavaVersion.current().isJava8Compatible()) {
+            // The ErrorProne plugin defaults to the latest, which would break our
+            // build if error prone releases a new version with a new check
+            errorprone 'com.google.errorprone:error_prone_core:2.0.19'
+        }
     }
 
     findbugs {
@@ -121,15 +133,21 @@
         // This skips proto generated files beucasue they are in gen_gradle/src/main/**
         source = fileTree(dir: "src/main", include: "**/*.java")
     }
-    checkstyleMain.onlyIf { !name.contains("proto") && !name.contains("shared") }
 
     checkstyleTest {
         // TODO(bdrutu): Enable this when we have tests checkstyle clean.
         // source = fileTree(dir: "src/test", include: "**/*.java")
         excludes = ["**"]
     }
+
+    // Disable checkstyle for proto and shared.
+    checkstyleMain.onlyIf { !name.contains("proto") && !name.contains("shared") }
     checkstyleTest.onlyIf { !name.contains("proto") && !name.contains("shared") }
 
+    // Disable checkstyle if no java8.
+    checkstyleMain.enabled = JavaVersion.current().isJava8Compatible()
+    checkstyleTest.enabled = JavaVersion.current().isJava8Compatible()
+
     // At a test failure, log the stack trace to the console so that we don't
     // have to open the HTML in a browser.
     test {