Table of Contents
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 Andrey Loskutov contributed major improvements to the plugin.
To use the FindBugs Plugin for Eclipse, you need Eclipse 3.3 or later, and JRE/JDK 1.5 or later.
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
Only provides official releases of FindBugs.
Provides official releases and release candidates of FindBugs.
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_18.104.22.16840706.zip?download. Extract it in Eclipse's "plugins" subdirectory. (So <eclipse_install_dir>/plugins/edu.umd.cs.findbugs.plugin.eclipse_22.214.171.12440706/findbugs.png should be the path to the FindBugs logo.)
Once the plugin is extracted, start Eclipse and choose→ → . You should find a plugin called "FindBugs Plug-in" provided by "FindBugs Project".
To get started, right click on a Java project in Package Explorer, 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 can also run FindBugs on existing java archives (jar, ear, zip, war etc). Simply create an empty Java project and attach archives to the project classpath. Having that, you can now right click the archive node in Package Explorer and select the option labeled "Find Bugs". If you additionally configure the source code locations for the binaries, FindBugs will also link the generated warnings to the right source files.
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.
Eclipse plugin supports contribution of custom FindBugs detectors (see also AddingDetectors.txt for more information). There are two ways to contribute custom plugins to the Eclipse:
Existing standard FindBugs detector packages can be configured via → → → → → . Simply specify there locations of any additional plugin libraries.
The benefit of this solution is that already existing detector packages can be used "as is", and that you can quickly verify the quality of third party detectors. The drawback is that you have to apply this settings in each new Eclipse workspace, and this settings can't be shared between team members.
It is possible to contribute custom detectors via standard Eclipse extensions mechanism.
Please check the documentation of the findBugsEclipsePlugin/schema/detectorPlugins.exsd extension point how to update the plugin.xml. Existing FindBugs detector plugins can be easily "extended" to be full featured FindBugs AND Eclipse detector plugins. Usually you only need to add META-INF/MANIFEST.MF and plugin.xml to the jar and update your build scripts to not to override the MANIFEST.MF during the build.
The benefit of this solution is that for given (shared) Eclipse installation each team member has exactly same detectors set, and there is no need to configure anything anymore. The (really small) precondition is that you have to convert your existing detectors package to the valid Eclipse plugin. You can do this even for third-party detector packages. Another major differentiator is the ability to extend the default FindBugs classpath at runtime with required third party libraries (see AddingDetectors.txt for more information).
This section lists common problems with the plugin and (if known) how to resolve them.
If you see OutOfMemory error dialogs after starting FindBugs analysis in Eclipse, please increase JVM available memory: change eclipse.ini and add the lines below to the end of the file:
Important: the configuration arguments starting with the line "-vmargs" must be last lines in the eclipse.ini file, and only one argument per line is allowed!
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.