How to change config to configDirectory of checkstyle Plugin in gradle 7.1.1?

Viewed 710

I have read in the documentation that config has been changed to configDirectory in checkstyle Plugin - gradle 7.1.1. But config has parameters of file type, whereas configDirectory has DirectoryProperty.

Gradle 6 - build.gradle

String path = "/abc/xyz";
apply plugin : 'checkstyle'

checkstyle { 
    config file(path) 
}

How do I convert the path to a directoryProperty? i.e., how do I write the same in gradle 7.1.1

I tried the same,

String path = "/abc/xyz";
apply plugin : 'checkstyle'

checkstyle { 
    configDirectory file(path) 
}

But I'm getting this error, while running gradle build,

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

1 Answers
Related