Search code examples
eclipse-pluginfindbugssuppress-warningshudson-plugins

Use findbug's surpresswarning annotations from eclipse in hudson


I got a hudson job which analyses the sources with findbugs. I'm currently using filters to surpress the warings but it would be better if I could surpress them directly in code.

I've seen that there is a findbugs plugin to analyse the code in eclipse and add annotations there. Do I need anything to make the annotations from eclipse work in hudson? The thing is I dont want to add FindBugs to the classpath of the projects... Is the eclipse plugin enouth and if yes what do I have to do to make it work in the hudson job.


Solution

  • The FindBugs annotation for suppressing false positives is @edu.umd.cs.findbugs.annotations.SuppressFBWarnings.

    In order to use the FindBugs annotations, the following two JAR files must be on the Classpath:

    • annotations-x.x.x.jar (replace 'x' with FindBugs version number)
    • jsr305.jar

    These files must be on the classpath of the process that performs the FindBugs analysis. They do not need to be on the classpath in production. In other words, you must add them to the Eclipse classpath and probably also in your build scripts (so that analysis works in Hudson). However, you do not need to deploy the files into production.

    If you don't want to modify the projects' classpath, then it will probably not work in Hudson. It should work in Eclipse, although you will be required to put them in some global classpath, which is kinda dirty.