我试图在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 check
和gradle build
都可以正常运行。