【问题标题】:Gradle task to aggregate checkstyle reports in a multi module project在多模块项目中聚合检查样式报告的 Gradle 任务
【发布时间】:2017-09-07 14:01:46
【问题描述】:

我有一个具有以下结构的多模块 gradle 项目:

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 新手,如果有人可以帮助我,那就太好了。如果您需要更多信息,请告诉我

【问题讨论】:

    标签: gradle checkstyle


    【解决方案1】:

    尝试包含您的配置以生成检查样式报告

    在每个模块的 build.gradle 文件中单独而不是包含这个 仅在您的项目 build.gradle 文件中。


    或者你可以使用这个插件

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

    它给出了正确的结果


    或使用 sonarqube -并在下面的链接中参考我的答案

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

    只是分享我的意见,希望对您有所帮助。

    【讨论】:

      猜你喜欢
      • 2018-09-09
      • 1970-01-01
      • 2018-11-21
      • 1970-01-01
      • 2013-05-31
      • 2013-06-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多