在多模块项目中聚合checkstyle报告的Gradle任务
我有一个多模块gradle项目,其结构如下:在多模块项目中聚合checkstyle报告的Gradle任务,gradle,checkstyle,Gradle,Checkstyle,我有一个多模块gradle项目,其结构如下: myProject | |-module1 |-src |-main |-test |-build.gradle |-module2 |-src |-main |-test |-build.gradle |-build.gradle 我有以下配置来生成checkstyle报告: checkstyle { toolVersion = '6.4.1' configFile
myProject
|
|-module1
|-src
|-main
|-test
|-build.gradle
|-module2
|-src
|-main
|-test
|-build.gradle
|-build.gradle
我有以下配置来生成checkstyle报告:
checkstyle {
toolVersion = '6.4.1'
configFile = rootProject.file("config/checkstyle/checkstyle.xml");
showViolations = true
ignoreFailures = true
reportsDir = file("$project.rootDir/reports/checkstyle/$project.name")
tasks.withType(Checkstyle) {
reports {
xml.enabled true
html.enabled true
}
}
}
checkstyleMain << {
ant.xslt(in: file("$project.rootDir/reports/checkstyle/$project.name/main.xml"),
style: rootProject.file('config/checkstyle-noframes-sorted.xsl'),
out: rootProject.file('config/aggregated.html'))
}
checkstyle{
toolVersion='6.4.1'
configFile=rootProject.file(“config/checkstyle/checkstyle.xml”);
showViolations=true
ignoreFailures=true
reportsDir=file(“$project.rootDir/reports/checkstyle/$project.name”)
任务。withType(Checkstyle){
报告{
启用xml.true
html.true
}
}
}
checkstyleMain尝试包含您的配置以生成checkstyle报告
分别在每个模块的build.gradle文件中,而不包括此
仅适用于您的项目build.gradle文件
或者你可以使用这个插件
下载链接-
它给出了适当的结果
或者使用sonarqube-并在下面的链接中参考我的答案
只是分享我的意见,希望能有所帮助