3

I have a multi module gradle project 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 checkstyle 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 aim to generate an aggregated checkstyle report that contains information from both these two modules. When I run "gradle checkstyleMain" the aggregated html report contains only checkstyle report information from module2 and ignores module1 information.

I am new to gradle it will be great if someone can help me out. Please let me know if you need additional information

Vikrant
  • 31
  • 2

1 Answers1

0

Try including your configurations to generate checkstyle report

in the build.gradle files of each module seprately instead of including this only on your projects build.gradle file.


Or you can use this plugin

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

it gives proper results


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

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

just sharing my opinion hope it helps.

Community
  • 1
  • 1
Amal p
  • 2,882
  • 4
  • 29
  • 49