简体   繁体   English

包含兄弟gradle模块中FindBugs分析所需的文件

[英]Including files needed for FindBugs analysis from sibling gradle modules

I have a gradle module that has a compile-time dependency on a sibling module. 我有一个gradle模块,它对兄弟模块有一个编译时依赖。

dependencies {
    compile project(':sibling-module')
}

While running the build, FindBugs can't seem to find the dependency, so I receive the following message: 在运行构建时,FindBugs似乎无法找到依赖项,因此我收到以下消息:

The following classes needed for analysis were missing:
  com.example.siblingmodule.classname

What do I need to do to include these files so that FindBugs can evaluate them? 我需要做些什么来包含这些文件,以便FindBugs可以评估它们? I am using FindBugs 3.0.1 and gradle 3.5. 我正在使用FindBugs 3.0.1和gradle 3.5。

I found the answer, and thank you to @webdizz for pointing me in the right direction. 我找到了答案,并感谢@webdizz指出我正确的方向。 The solution was to add the sibling module output to the findbugs classpath. 解决方案是将兄弟模块输出添加到findbugs类路径。 I did so with the following addition to the complaining module's build.gradle : 我在抱怨模块的build.gradle添加了以下build.gradle

findbugsMain {
    classpath += project(':sibling-module').sourceSets.main.output
}

The important bit was to include the main.output , and not just the main.allSource . 重要的是包括main.output ,而不仅仅是main.allSource

Well it looks like Gradle has no property to configure classpath for FindBugs however it still has a sourceSets property to specify source code folder to analyse. 好吧,看起来Gradle没有为FindBugs配置类路径的属性,但它仍然有一个sourceSets属性来指定要分析的源代码文件夹。

Please check FindBugs configuration object for Gradle for more details. 有关详细信息,请查看Gradle的FindBugs配置对象

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM