Customize task - unresolved reference: enabled

I’ve tried with:

tasks.withType<com.github.spotbugs.SpotBugsTask> {
    reports.xml.enabled = false
    reports.html.enabled = true
}

I got these compilation errors:

Script compilation errors:

  Line 20:     reports.xml.enabled = false
                           ^ Unresolved reference: enabled

  Line 21:     reports.html.enabled = true
                            ^ Unresolved reference: enabled

My script is:

plugins {
    `java-library`
    id("com.github.spotbugs") version "1.6.9"
}

tasks.withType<com.github.spotbugs.SpotBugsTask> {
    reports.xml.enabled = false
    reports.html.enabled = true
}

repositories {
    jcenter()
}