THRIFT-5568: enforce consistent Java formatting (#2581)

* use spotless plugin and google-java-format to enforce a consistent code format
* add a step of spotless check before building
* only run spotless on the src/ directory

Co-authored-by: Christopher Tubbs <ctubbsii@apache.org>
diff --git a/lib/java/gradle/codeQualityChecks.gradle b/lib/java/gradle/codeQualityChecks.gradle
index a353097..f633413 100644
--- a/lib/java/gradle/codeQualityChecks.gradle
+++ b/lib/java/gradle/codeQualityChecks.gradle
@@ -43,3 +43,12 @@
         xml.enabled = false
     }
 }
+
+spotless {
+    java {
+        target project.fileTree(project.rootDir) {
+          include 'src/**/*.java'
+        }
+        googleJavaFormat()
+    }
+}