2017-04-12 110 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?

只是分享我的意見,希望它有幫助。