THRIFT-5553: use newer gradle API (#2561)

Prepare for moving to Gradle 7 by removing use of older Gradle directives
(except the use of maven; the transition to maven-publish is not included here)
diff --git a/lib/java/gradle/functionalTests.gradle b/lib/java/gradle/functionalTests.gradle
index 15737f5..e8a3e89 100644
--- a/lib/java/gradle/functionalTests.gradle
+++ b/lib/java/gradle/functionalTests.gradle
@@ -34,15 +34,27 @@
     }
 }
 
+// see https://docs.gradle.org/current/userguide/java_library_plugin.html
+// 1. defines cross test implementation that includes all test implementation, which in turn
+//    contains all implementation dependencies
+// 2. defines cross test runtime that further includes test runtime only dependencies
+// 3. the cross test implementation will need to depends on main and test output
+// 4. shadow jar will package both main and test source set, along with cross test runtime dependencies
 configurations {
-    crossTestCompile { extendsFrom testCompile }
-    crossTestRuntime { extendsFrom crossTestCompile, testRuntime }
+    crossTestImplementation {
+        description "implementation for cross test"
+        extendsFrom testImplementation
+    }
+    crossTestRuntime {
+        description "runtime dependencies for cross test"
+        extendsFrom crossTestImplementation, testRuntimeOnly
+    }
 }
 
 dependencies {
-    crossTestCompile "org.apache.tomcat.embed:tomcat-embed-core:${tomcatEmbedVersion}"
-    crossTestCompile sourceSets.main.output
-    crossTestCompile sourceSets.test.output
+    crossTestImplementation "org.apache.tomcat.embed:tomcat-embed-core:${tomcatEmbedVersion}"
+    crossTestImplementation sourceSets.main.output
+    crossTestImplementation sourceSets.test.output
 }
 
 // I am using shadow plugin to make a self contained functional test Uber JAR that
@@ -53,19 +65,17 @@
     description = 'Assemble a test JAR file for cross-check execution'
     // make sure the runners are created when this runs
     dependsOn 'generateRunnerScriptForClient', 'generateRunnerScriptForServer', 'generateRunnerScriptForNonblockingServer', 'generateRunnerScriptForTServletServer'
-
-    baseName = 'functionalTest'
-    destinationDir = file("$buildDir/functionalTestJar")
-    classifier = null
-
+    archiveBaseName.set('functionalTest')
+    destinationDirectory = file("$buildDir/functionalTestJar")
+    archiveClassifier.set(null)
     // We do not need a version number for this internal jar
-    version = null
-
+    archiveVersion.set(null)
     // Bundle the complete set of unit test classes including generated code
     // and the runtime dependencies in one JAR to expedite execution.
+    // see https://imperceptiblethoughts.com/shadow/custom-tasks/
     from sourceSets.test.output
     from sourceSets.crossTest.output
-    configurations = [project.configurations.testRuntime]
+    configurations = [project.configurations.crossTestRuntime]
 }
 
 // Common script runner configuration elements