I am trying to apply the checkstyle plugin to my gradle project. The configuration of which is in a seperate, shared jar dependency:
project.apply plugin: StaticAnalysisPlugin
class StaticAnalysisPlugin implements Plugin<Project> {
@Override
void apply(Project project) {
project.apply plugin: 'checkstyle'
project.configurations {
codingStandardsConfig
}
project.dependencies {
codingStandardsConfig 'com.sample.tools:coding-standards:1.+:@jar'
}
def checkstyleConfigFileLocation = "classpath:sample-checkstyle-config.xml"
project.checkstyle {
toolVersion = '6.3'
project.logger.debug "$project Using checkstyle version $toolVersion."
project.logger.debug "$project Using checkstyle config from: ${checkstyleConfigFileLocation}"
config = project.resources.text.fromFile(checkstyleConfigFileLocation)
}
project.checkstyleMain.source = "src/main/java"
project.checkstyleTest.exclude "**/*"
}
}
the config file is located in the coding-standards jar, but I am unsure how to wire this in to the checkstyle config.