2017-04-12 113 views
2

我有具有以下结构的多模块gradle这个项目:摇篮任务聚集的CheckStyle报告在多模块项目

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报告,其中包含来自这两个模块的信息。当我运行“gradle checkstyleMain”时,汇总的html报告仅包含来自module2的checkstyle报告信息并忽略module1信息。

我是gradle新手,如果有人能帮助我,那将会很棒。请让我知道如果你需要更多的信息

回答

0

尝试,包括你的配置生成的CheckStyle报告

在每个模块的build.gradle文件

seprately,而不是包括本 只在您的项目的build.gradle文件。


或者你可以使用这个插件

下载链接 - https://plugins.jetbrains.com/plugin/1065-checkstyle-idea

它给出正确的结果


或者使用sonarqube -and是指在链接我的回答如下

What is the correct way to configure an Android project with submodules for use with the sonarqube gradle plugin?

只是分享我的意见,希望它有帮助。