How does the Checkstyle plugin update work from Gradle 6.8.2 to 7.1.1

I’m upgrading my gradle from 6.8.2 to 7.1.1. The checkstyle plugin no longer supports configDir which requires a file parameter. It is now changed to configDirectory which needs a directoryProperty as parameter.

Gradle -6 build.gradle

String path = "abc/xyz"

checkstyle {
    configDir file(path)
}

Now in Gradle - 7.1.1 build.gradle

String path = "abc/xyz"

checkstyle {
    configDirectory file(path)
}

This is giving me an error while building:

Could not find method configDirectory() for arguments […path…] on extension ‘checkstyle’ of type org.gradle.api.plugins.quality.CheckstyleExtension.

To set a Property, you either call .set(...) on it, or use the Groovy DSL sugar =.
So if you do configDirectory.set(file(path)) or configDirectory = file(path) it should work properly.

1 Like