The installation of findbugs is required for the Jenkins version, so it is necessary to determine whether the current version can be installed findbugs before installation. Currently we are using jenkins1.609.2,Findbugs4.61.
Install the ANALYSIS-CORE.HPI plugin before installing the plugin
Findbugs ( Findbugs.hpi ) can automate code walk-through, be able to prompt for spam code or provide recommendations for code optimization, look for code flaws,
For example: A. database connection not closed;
B. Lack of necessary null check;
C. redundant null check;
D. Excess if post-conditions;
E. The same conditions branch;
F. Duplicate code blocks;
G. Wrong use of "= =";
H. It is recommended that stringbuffer be used instead of string addition;
(1) Jenkins install FindBugs plug-in
Specific installation steps: Enter system management on the main page
Select Plug-in management
Find the plug-in you want to install in the filter and install it
(2) Pom.xml configuration FindBugs plug-in
Because our company project code each module independent development, each module has a pom.xml file, and different modules and dependencies, and each pom.xml is inherited from the base module, so we only need to be configured in the most basic Pom.xml file.
The following is the specific configuration information.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>2.5.2</version>
<configuration>
<findbugsXmlOutput>true</findbugsXmlOutput>
<findbugsXmlWithMessages>true</findbugsXmlWithMessages>
<xmlOutput>true</xmlOutput>
</configuration>
</plugin>
(3) After configuration, set findbugs:findbugs in the goals of Jenkins and select Publish findbugs analysis results in the build settings. For our project, we need to skip JUnit's tests so that there are more other configurations. Configuration needs to be configured in each job, not listed here.
(4) Verify the installation of the findbugs.
After the plug-in is installed, and the configuration information is also configured, you can do findbugs verification, we only need to build the project, after the build can see the findbugs run record.
For more information, refer to:
Https://wiki.jenkins-ci.org/display/JENKINS/FindBugs+Plugin
Jenkins integrated FindBugs plug-in for static code analysis