Gradle-如何在/src/test/java上排除Findbugs [英] Gradle - how to exclude Findbugs on /src/test/java

查看:142
本文介绍了Gradle-如何在/src/test/java上排除Findbugs的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一种方法可以排除/src/test/java下的类上的Findbugs执行.我尝试了以下操作,但似乎不起作用.

Is there a way to exclude Findbugs execution on classes under /src/test/java. I tried the following but it doesn't seem to work.

classes = classes.filter {
   !it.path.contains("**classes\\test\\org*")
}

推荐答案

好的. Findbugs的文档扩展程序说:

sourceSets:在检查和构建任务中要分析的源集.

sourceSets : The source sets to be analyzed as part of the check and build tasks.

上面的示例显示了一个完全按照您的要求进行操作的示例:

And the example just above shows an example doing exactly what you want:

apply plugin: "findbugs"

findbugs {
    sourceSets = [sourceSets.main]
}

即仅分析主sourceSet,而不分析测试sourceSet.

i.e. only analyze the main sourceSet, and not the test sourceSet.

这篇关于Gradle-如何在/src/test/java上排除Findbugs的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆