Gradle task to merge control line reports in a project with multiple modules

I have a project with several gradle modules having the following structure:

myProject
|
|-module1
  |-src
    |-main
    |-test
  |-build.gradle
|-module2
  |-src
    |-main
    |-test
  |-build.gradle
|-build.gradle

      

I have the following configurations to generate a control report:

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'))
    }

      

My goal is to create an aggregated checklist report containing information from both of these two modules. When I run "gradle checkstyleMain", the aggregated html report only contains the checkstyle report information from module2 and ignores the module1 information.

I am new to gradle, it would be great if someone can help me. Please let me know if you need more information.

+3


source to share


1 answer


Try enabling the configuration to generate a control report.

in the build.gradle files of each module separately, instead of only including it on your build.gradle file projects.


Or you can use this plugin

Download link - https://plugins.jetbrains.com/plugin/1065-checkstyle-idea



it gives correct results


Or use sonarqube -And link to my answer in the link below

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

just share your opinion, hope it helps.

0


source







All Articles