How to set auxclasspath in spotbugs gradle plugin?

currently when I run spotbugs on my project, it will report lots of classes names printed following “The following classes needed for analysis were missing:”. After digging around, I find that I have to manually overwrite the ./build/spotbugs/auxclasspath/spotbugsMain file with jar files under my gradle cache directory – I don’t know why spotbugs will look for the jar files there either. But anyway, if I manually put the jar files list in this spotbugsMain file above then spotbugs run without reporting any warning messages any more. But then I realized that this file would be overwritten each time the gradle run. So my question is:

  1. how to disable spotbugs to look for the gradle cache directory?
  2. If 1 is not feasible, how to specify the auxclasspath in gradle config file without manual changes?