Chapter 7. Using the FindBugs™ Eclipse plugin

Table of Contents

1. Requirements
2. Installation
3. Using the Plugin
4. Troubleshooting

The FindBugs Eclipse plugin allows FindBugs to be used within the Eclipse IDE. The FindBugs Eclipse plugin was generously contributed by Peter Friese. Phil Crosby and Andrei Loskutov contributed major improvements to the plugin.

1. Requirements

To use the FindBugs Plugin for Eclipse, you need Eclipse 3.3 or later, and JRE/JDK 1.5 or later.

2. Installation

We provide update sites that allow you to automatically install FindBugs into Eclipse and also query and install updates. There are three different update sites

FindBugs Eclipse update sites

http://findbugs.cs.umd.edu/eclipse/

Only provides official releases of FindBugs.

http://findbugs.cs.umd.edu/eclips-candidate/

Provides official releases and release candidates of FindBugs.

http://findbugs.cs.umd.edu/eclipse-daily/

Provides the daily build of FindBugs. No testing other than that it compiles.

You can also manually download the plugin from the following link: http://prdownloads.sourceforge.net/findbugs/edu.umd.cs.findbugs.plugin.eclipse_1.3.7.20081230.zip?download. Extract it in Eclipse's "plugins" subdirectory. (So <eclipse_install_dir>/plugins/edu.umd.cs.findbugs.plugin.eclipse_1.3.7.20081230/findbugs.png should be the path to the FindBugs logo.)

Once the plugin is extracted, start Eclipse and choose HelpAbout Eclipse PlatformPlug-in Details. You should find a plugin called "FindBugs Plug-in" provided by "FindBugs Project".

3. Using the Plugin

To get started, right click on a Java project, and select the option labeled "Find Bugs". FindBugs will run, and problem markers (displayed in source windows, and also in the Eclipse Problems view) will point to locations in your code which have been identified as potential instances of bug patterns.

You may customize how FindBugs runs by opening the Properties dialog for a Java project, and choosing the "Findbugs" property page. Options you may choose include:

  • Enable or disable the "Run FindBugs Automatically" checkbox. When enabled, FindBugs will run every time you modify a Java class within the project.

  • Choose minimum warning priority and enabled bug categories. These options will choose which warnings are shown. For example, if you select the "Medium" warning priority, only Medium and High priority warnings will be shown. Similarly, if you uncheck the "Style" checkbox, no warnings in the Style category will be displayed.

  • Select detectors. The table allows you to select which detectors you want to enable for your project.

4. Troubleshooting

The FindBugs Eclipse plugin is still experimental.  This section lists common problems with the plugin and (if known) how to resolve them.

  • If you do not see any FindBugs problem markers (in your source windows or in the Problems View), you may need to change your Problems View filter settings. See http://findbugs.sourceforge.net/FAQ.html#q7 for more information.