``` import com.github.spotbugs.SpotBugsTask import...
# gradle
x
Copy code
import com.github.spotbugs.SpotBugsTask
import com.github.spotbugs.SpotBugsPlugin
import io.spring.gradle.dependencymanagement.DependencyManagementPlugin
import io.spring.gradle.dependencymanagement.dsl.DependencyManagementExtension
import io.spring.gradle.dependencymanagement.internal.DependencyManagement
import org.gradle.api.credentials.AwsCredentials
import org.gradle.kotlin.dsl.maven
import org.gradle.kotlin.dsl.repositories
import io.spring.gradle.dependencymanagement.internal.DependencyManagementSettings
import io.spring.gradle.dependencymanagement.internal.dsl.StandardDependencyManagementExtension
import org.gradle.kotlin.dsl.creating
import org.gradle.kotlin.dsl.support.illegalElementType
import org.gradle.plugins.ide.idea.model.IdeaModel
import org.gradle.plugins.ide.idea.model.IdeaProject
import java.lang.System

buildscript {
    repositories {
        maven(System.getenv("JAR_REPOSITORY_URI"))
        jcenter()
    }
    dependencies {
        classpath("io.spring.gradle:dependency-management-plugin:latest.release")
    }
}

plugins {
    id("com.github.spotbugs").version("1.6.0")
    id("net.ltgt.errorprone").version("0.0.13")
    id("net.ltgt.apt").version("0.13")
    id("net.ltgt.apt-idea").version("0.13")
    id("java-library")
    id("java")
    id("maven-publish")
}

repositories {
    maven(System.getenv("JAR_REPOSITORY_URI"))
    jcenter()
}

group = "com.xenoterracide"
version = "0.1.4-SNAPSHOT"


// Apply the java plugin to add support for Java
apply {
    plugin<IdeaPlugin>()
    plugin<CheckstylePlugin>()
    plugin<SpotBugsPlugin>()
    plugin<MavenPublishPlugin>()
    plugin<JavaLibraryPlugin>()
    plugin<DependencyManagementPlugin>()
}

configure<StandardDependencyManagementExtension> {
    imports {
        mavenBom("com.xenoterracide:bom:0.1.0-SNAPSHOT")
    }
}

// In this section you declare the dependencies for your production and test code
dependencies {
    errorprone("com.google.guava:guava:22.0")
    errorprone("com.google.errorprone:error_prone_core:latest.release")
    compileOnly("org.immutables:value")

    implementation("org.slf4j:slf4j-api")
    implementation("com.google.guava:guava")
    compileOnly("org.immutables:value")
    apt("org.immutables:builder")
    testCompileOnly("org.immutables:value")
    testImplementation("junit:junit")
    testImplementation("org.assertj:assertj-core")
    testImplementation("org.mockito:mockito-core")
    testImplementation("org.hamcrest:hamcrest-library")
}

configure<IdeaModel> {
    module {
        isDownloadSources = true
        isDownloadJavadoc = true
    }
}

configure<CheckstyleExtension> {
    toolVersion = "8.4"
    sourceSets.addAll(java.sourceSets.filter { it.name != "test" })
}

spotbugs {
    toolVersion = "3.1.0"
    effort = "max"
    reportLevel = "low"
    excludeBugsFilter = file("config/spotbugs/exclude.xml")
    sourceSets.addAll(java.sourceSets.filter { it.name != "test" })
}

val sourcesJar by tasks.creating(Jar::class) {
    classifier = "sources"
    from(java.sourceSets["main"].allSource)
}

publishing {
    repositories {
        maven {
            url = uri(System.getenv("JRS_S3_URI") ?: uri(""))
            credentials(AwsCredentials::class.java) {
                accessKey = System.getenv("JRS_ACCESSKEYID")
                secretKey = System.getenv("JRS_SECRETACCESSKEY")
            }
        }
    }
    (publications) {
        "mavenJava"(MavenPublication::class) {
            from(components["java"])
            artifact(sourcesJar)
        }
    }
}

tasks.withType<Checkstyle> {
    reports {
        xml.isEnabled = false
        html.isEnabled = false
    }
}

tasks.withType<SpotBugsTask> {
    reports {
        xml.isEnabled = false
    }
}

tasks.withType<JavaCompile> {
    options.compilerArgs.addAll(listOf(
        "-XepExcludedPaths:.*/build/classes/.*",
        "-Xep:MissingOverride:ERROR",
        "-Xep:Var:ERROR"
    ))
}