If findbugs is too strict to you, you might want to bypass some checking rules. Here is the way.

We need tell findbugs plugin uses our configuration rather default.

    <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>findbugs-maven-plugin</artifactId>
        <configuration>
            <debug>true</debug>
        </configuration>
    </plugin>

run

mvn findbugs:findbugs

then, we got a report like this.

    <?xml version="1.0" encoding="UTF-8"?>
    <BugCollection version='1.3.9' threshold='medium' effort='min'>
        <file classname='com.bellwin.idcview.Jqgrid%24Cell'>
            <BugInstance type='URF_UNREAD_FIELD' priority='Normal' category='PERFORMANCE'
              message='Unread field: com.bellwin.idcview.Jqgrid$Cell.cell' lineNumber='16' />
        </file>
        <file classname='com.bellwin.idcview.device.servlet.DeviceServlet'>
            <BugInstance type='SE_BAD_FIELD' priority='Normal' category='BAD_PRACTICE'
              message='Class com.bellwin.idcview.device.servlet.DeviceServlet defines non-transient non-serializable instance field deviceService'
              lineNumber='-1' />
        </file>
        <Error></Error>
        <Project>
            <SrcDir>D:\dev\workspaces\bellwin\web\src\main\java</SrcDir>
        </Project>
    </BugCollection>

The above report was output by findbugs. There are two rules not pass

  1. URF_UNREAD_FIELD in PERFORMANCE category
  2. SE_BAD_FIELD in BAD_PRACTICE category

If we want don’t want to check the rule URF_UNREAD_FIELD, we need check findbugs.xml setting file.

      <Detector class="edu.umd.cs.findbugs.detect.UnreadFields" 
                speed="fast"
                reports="ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD,NP_UNWRITTEN_FIELD,UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR,UWF_NULL_FIELD,UWF_UNWRITTEN_FIELD,SS_SHOULD_BE_STATIC,UUF_UNUSED_FIELD,URF_UNREAD_FIELD,SIC_INNER_SHOULD_BE_STATIC,SIC_INNER_SHOULD_BE_STATIC_ANON,SIC_INNER_SHOULD_BE_STATIC_NEEDS_THIS,SIC_THREADLOCAL_DEADLY_EMBRACE" />

The URF_UNREAD_FIELD rule is implemented by UnreadFields class. We put UnreadFields to <omitVisitors> tag of plugin’s configuration. This forece Findbugs omit the URF_UNREAD_FIELD rule.

    <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>findbugs-maven-plugin</artifactId>
        <configuration>
            <omitVisitors>UnreadFields</omitVisitors>
            <!--
               Uses comma-delimited to apply more rules
               <omitVisitors>FindDeadLocalStores,UnreadFields</omitVisitors>
            -->
            <debug>true</debug>
        </configuration>
    </plugin>