LoginSignup
2
2

More than 5 years have passed since last update.

How to use findbugs in Apache Hadoop project

Posted at

This blog post is for Hadoop developers. It may be as a reference for you if you are not a Hadoop developer.

Detect findbugs warnings

$ mvn clean
$ mvn install -DskipTests
$ mvn findbugs:findbugs

You can see the following message if there are some findbugs warnings

[INFO] ------------------------------------------------------------------------
[INFO] Building Apache Hadoop Data Join 3.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- findbugs-maven-plugin:3.0.0:findbugs (default-cli) @ hadoop-datajoin ---
[INFO] Fork Value is true
     [java] Picked up _JAVA_OPTIONS: -Dfile.encoding=UTF-8
     [java] Warnings generated: 2
[INFO] Done FindBugs Analysis....

View the warnings via GUI

If there are findbugs warnings in hadoop-datajoin module, do the following:

$ cd hadoop-tools/hadoop-datajoin
$ mvn findbugs:gui

Screen Shot 2015-09-03 at 20.34.40.png

Open a window as the above screenshot. You can easily detect the code which causes findbugs warnings.

Output HTML

When findbugs:findbugs is executed, the output is XML. It is difficult to know what the warnings are by reading the XML file. Nothing to worry about, we can easily convert the XML file to HTML so that we can know what the warnings are. Unlike gui, we can attach the file in JIRA to share the problem.

Prequisites: findbugs is installed and $FINDBUGS_HOME is set appropriately.

$ $FINDBUGS_HOME/bin/convertXmlToText -html target/findbugsXml.xml target/findbugsHtml.html

Summary

findbugs:gui is very useful.

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2