Search code examples
javagradlefindbugsspotbugs

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.

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

While running the build, FindBugs can't seem to find the dependency, so I receive the following message:

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? I am using FindBugs 3.0.1 and gradle 3.5.


Solution

  • I found the answer, and thank you to @webdizz for pointing me in the right direction. The solution was to add the sibling module output to the findbugs classpath. I did so with the following addition to the complaining module's 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.