FindBugs is another tool that uses static analysis to inspect Java bytecode for bugs in a Java code. It is based on the concept of bug patterns. A bug pattern is a code snippet that is often an error.
Let us see how we can use the Maven FindBugs plugin to analyze and identify defects in our code:
mvn clean compile findbugs:findbugs
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ project-with-violations --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 1 source file to C:\projects\apache-maven cookbook\project-with-violations\target\classes ...