Update gradle to version 6.7

Use the Java Library plugin and switch to the new (non-deprecated)
syntax for declaring dependencies.
Various other cleanups/modernizations in build.gradle.

Change-Id: Iac6734562eeda68c588a93775596f1e598eafd1f
diff --git a/build.gradle b/build.gradle
index c9756af..31e8b4e 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,33 +1,21 @@
-buildscript {
-  repositories {
-    mavenLocal()
-    jcenter()
-    mavenCentral()
-  }
-}
-
 plugins {
-  id 'java'
-  id 'maven'
+  id 'java-library'
+  id 'maven' // TODO: migrate to 'maven-publish'
   id 'signing'
   id 'checkstyle'
-  id 'org.sonarqube' version '2.8'
-  id 'net.saliman.cobertura' version '3.0.0'
+  id 'org.sonarqube' version '3.0'
+  id 'net.saliman.cobertura' version '4.0.0'
 }
 
 group = 'net.named-data.jndn-extra'
 version = '1.3.0'
 
-sourceCompatibility = JavaVersion.VERSION_1_8
-targetCompatibility = JavaVersion.VERSION_1_8
-compileJava.options.encoding = 'UTF-8'
-
 repositories {
   mavenLocal()
   jcenter()
   mavenCentral()
   maven {
-    url "https://oss.sonatype.org/content/repositories/releases/"
+    url 'https://oss.sonatype.org/content/repositories/releases'
   }
 }
 
@@ -41,81 +29,74 @@
     java {
       compileClasspath += main.output + test.output
       runtimeClasspath += main.output + test.output
-      srcDir file('src/test/java')
+      srcDir 'src/test/java'
       include '**/*IT.java'
     }
   }
 }
 
 configurations {
-  checkstyleConfig
-  integrationTestCompile.extendsFrom testCompile
-  integrationTestRuntime.extendsFrom testRuntime
+  integrationTestImplementation.extendsFrom testImplementation
+  integrationTestRuntimeOnly.extendsFrom testRuntimeOnly
 }
 
 dependencies {
-  compile 'net.named-data:jndn:0.24'
+  api 'net.named-data:jndn:0.24'
 
-  testCompile 'junit:junit:4.12'
-  testCompile 'net.named-data.jndn-extra:jndn-mock:1.2.0'
-  testRuntime 'org.slf4j:slf4j-api:1.7.30'
-
-  checkstyleConfig 'com.puppycrawl.tools:checkstyle:8.23'
+  testImplementation 'junit:junit:4.12'
+  testImplementation 'net.named-data.jndn-extra:jndn-mock:1.2.0'
+  testRuntimeOnly 'org.slf4j:slf4j-api:1.7.30'
 }
 
-task javadocJar(type: Jar) {
-  classifier = 'javadoc'
-  from javadoc
+java {
+  sourceCompatibility = JavaVersion.VERSION_1_8
+  targetCompatibility = JavaVersion.VERSION_1_8
+  withJavadocJar()
+  withSourcesJar()
 }
 
-task sourcesJar(type: Jar) {
-  classifier = 'sources'
-  from sourceSets.main.allSource
+tasks.withType(JavaCompile) {
+  options.deprecation = true
+  options.encoding = 'UTF-8'
+}
+
+tasks.withType(Javadoc) {
+  options.addBooleanOption('Xdoclint:none', true)
 }
 
 task integrationTest(type: Test) {
-  description 'Compile and run integration tests'
+  description 'Runs integration tests.'
   group = 'verification'
 
   testClassesDirs = sourceSets.integrationTest.output.classesDirs
   classpath = sourceSets.integrationTest.runtimeClasspath
 
-  mustRunAfter test
-}
-
-tasks.withType(JavaCompile) {
-  options.deprecation = true
+  shouldRunAfter test
 }
 
 tasks.withType(Test) {
-  reports.html.destination = file("${reporting.baseDir}/${name}")
-  testLogging {
-    events "passed", "skipped", "failed"
-    showStandardStreams = true
-    exceptionFormat = "full"
-  }
   outputs.upToDateWhen { false }
-}
-
-tasks.withType(Checkstyle) {
-  checkstyleClasspath = project.configurations.checkstyleConfig
-  checkstyleMain {
-    exclude 'com/intel/jndn/management/enums/NfdTlv.java'
-  }
-  checkstyleTest {
-    configFile file('config/checkstyle/checkstyle-test.xml')
-  }
-  checkstyleIntegrationTest {
-    configFile file('config/checkstyle/checkstyle-test.xml')
+  testLogging {
+    events "passed", "failed", "skipped"
+    exceptionFormat "full"
   }
 }
 
-if (JavaVersion.current().isJava8Compatible()) {
-  allprojects {
-    tasks.withType(Javadoc) {
-      options.addStringOption('Xdoclint:none', '-quiet')
-    }
-  }
+checkstyle {
+  toolVersion '8.23'
+}
+checkstyleMain {
+  exclude 'com/intel/jndn/management/enums/NfdTlv.java'
+}
+checkstyleTest {
+  configFile file('config/checkstyle/checkstyle-test.xml')
+}
+checkstyleIntegrationTest {
+  configFile file('config/checkstyle/checkstyle-test.xml')
+}
+
+cobertura {
+  coverageFormats = ['html', 'xml']
 }
 
 artifacts {
@@ -183,7 +164,3 @@
     }
   }
 }
-
-cobertura {
-  coverageFormats = ['html', 'xml']
-}