【问题标题】:Configure findBugs in Gradle 1.10在 Gradle 1.10 中配置 findBugs
【发布时间】:2014-02-07 09:45:11
【问题描述】:

我正在尝试在我的项目中配置 findbugs

findbugs {
    ignoreFailures = true
    reports {
        html { enabled = true }
        xml.enabled = !html.enabled
    }
}

但是出现错误

  Could not find method reports() for arguments

 [quality_4gppo4hjtn3ur86ac71a18pai6$_run_closure2_closure4@6651ccf] 
on root project 'Project'.

此代码在我之前的一个 Gradle 1.7 项目中使用过,并且可以正常工作。

【问题讨论】:

    标签: gradle report findbugs


    【解决方案1】:

    您可以在 FindBugs 任务上使用报告方法。 findbugs 插件为每个源集创建一个。所以如果你想在你的主类上使用 FindBugs,你会使用

    findbugsMain {
        ignoreFailures = true
        reports {
            html { enabled = true }
            xml.enabled = !html.enabled
        }
    }
    

    如果您想以相同的方式配置所有 findbugs 任务,则只需将相同的配置应用于所有任务:

    tasks.withType(FindBugs) {
        ignoreFailures = true
        reports {
            html { enabled = true }
            xml.enabled = !html.enabled
        }
    }
    

    【讨论】:

    • 好的,但就我而言,我有超过 20 个源集,我想一次配置所有。
    猜你喜欢
    • 2013-06-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-03-29
    • 2018-06-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多