-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot suppress SpotBug warnings in generated code #27
Comments
Good case! This is a quality plugin issue. The root problem is that new spotbugs plugin use gradle properties instead of direct fields, which force me to do many hacks to init them early because otherwise values simply ignored (read property can't be updated and gradle read task properties too early). As a result:
The only workaround for you now is to modify default exclusions file:
<Match>
<Source name="~.*?MapperImpl.*" />
</Match> After that, you can remove all additional configurations in build.gradle Issues list (to not forget):
|
Thanks a lot for the quick reply! That workaround is fine for us. |
If possible, try to generate sources into a special package to be able to exclude an entire package with standard spotbugs exclusions file. |
I have been fighting this for a couple of hours:
We use the mapstruct annotation processor and SpotBugs complains about code generated by that annotation processor.
I tried using "exclude", but that has no effect.
I would like to move the apt generated sources to another source set, but I don't even know if that is possible.
The docs mention that I have misconfigured my build: "If non of the above works for you, then you did sources configuration not according to best practices."
I tried using "excludeSources", but that, too, just has no effect.
Finally I tried to configure an exclusion file for SpotBugs, but probably I made a mistake, because it seems to be completely ignored.
BTW: The page in the docs at "User guide -> Configuration" has a bug, it says to use "afterEvaluation {". That should be "afterEvaluate {".
See here for an example project: https://github.com/eekboom/qualitymapstruct
The text was updated successfully, but these errors were encountered: