如何在不使用XML的情况下排除findbugs gradle插件中的类

时间:2015-10-19 02:25:06

标签: gradle findbugs

我试图在gradle设置中从findbugs分析中排除几个类

apply plugin: 'application'
apply plugin: 'findbugs' 

....
tasks.withType(FindBugs) {

  def excludeProtobufFiles = 'com/turn/protobufkafka/'
  classes = classes.filter {
    !it.path.contains(excludeProtobufFiles)
  }

  // Generate HTML output for findbugs
  reports {
    xml.enabled = false
    html.enabled = true
  }
}

有了这个更改,gradle build工作正常但gradle check失败了:

:findbugsMain FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':findbugsMain'.
> No classes configured for FindBugs analysis.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 1.58 secs
但是,如果我先运行gradle check

gradle build可以正常工作。有没有办法在gradle中为findbugs排除文件,这样gradle check可以正常工作。

如果没有排除的类,gradle checkgradle build都可以正常运行。

0 个答案:

没有答案