THRIFT-5584: use gradle toolchain to specify Java 11 with --release 8 (#2606)

* use gradle toolchain to specify Java 11 with --release 8
* use newer syntax
* fix spotless apply
* remove legacy apply and bump version of spot bugs
* migrate pmd to new plugin syntax
diff --git a/lib/java/gradle/codeQualityChecks.gradle b/lib/java/gradle/codeQualityChecks.gradle
index b8d13f9..0ce47f7 100644
--- a/lib/java/gradle/codeQualityChecks.gradle
+++ b/lib/java/gradle/codeQualityChecks.gradle
@@ -5,11 +5,9 @@
 
 dependencies {
     spotbugs configurations.spotbugsPlugins.dependencies
-    spotbugsPlugins 'com.h3xstream.findsecbugs:findsecbugs-plugin:1.11.0'
+    spotbugsPlugins 'com.h3xstream.findsecbugs:findsecbugs-plugin:1.12.0'
 }
 
-apply plugin: 'com.github.spotbugs'
-
 // see https://spotbugs-gradle-plugin.netlify.app/com/github/spotbugs/snom/spotbugsextension
 spotbugs {
     ignoreFailures = true
@@ -28,8 +26,6 @@
     }
 }
 
-apply plugin: 'pmd'
-
 pmd {
     ignoreFailures = true
     toolVersion = '6.0.0'
@@ -46,9 +42,7 @@
 
 spotless {
     java {
-        target project.fileTree(project.rootDir) {
-          include 'src/**/*.java'
-        }
+        target 'src/**/*.java'
         googleJavaFormat()
     }
 }