FindBugs, Checkstyle, PMD installation and use of the eclipse plugin
First, what is FindBugs, Checkstyle, PMD
Findbugs, Checkstyle, and PMD can be plugged into eclipse as plug-ins, but there are also separate tools to implement their functions, such as the Findbugs tool that can be used without having to plug into eclipse.
The functions of the three are shown in the following table:
Tools |
Objective |
Check items |
Findbugs Check. Class |
Find potential bugs in the Javabytecode (. class file) based on the bug patterns concept |
The main check bytecode in the bug patterns, such as Nullpoint null pointer check, do not properly close the resource, string the same wrong (= =, not equals), etc. |
Pmd Check the source file |
Check for potential problems in Java source files |
Mainly include: Empty Try/catch/finally/switch statement block Unused local variables, parameters, and private methods Empty if/while Statements Overly complex expressions, such as unnecessary if statements, etc. Complex classes |
CheckStyle Check the source file Main focus Format |
Check if the Java source file matches the code specification |
Mainly include: Javadoc notes Naming conventions Extra Useless imports A size measure, such as a method that is too long The necessary space is missing whitespace Duplicate code |
This table goes from: http://blog.csdn.net/ml5271169588/article/details/6975701
As open-source software, we can use it with no fear, without regard to copyright issues. Their source code is saved on the http://sourceforge.net/, download can also go here to download.
Ii. installation of Findbugs, Checkstyle and PMD
The first thing to note is that my Computer eclipse is the Luna version, and the JDK is 1.8.
Eclipse and JDK installation is not much to say, it is easy to search, and the current JDK does not need a complex configuration, basically as long as the download and then install the good.
Then the detailed introduction of FindBugs, Checkstyle, PMD installation (using the three-part description: How to install the Eclipse plug-in download plug-in installation plugin)
1. How to install the Eclipse plugin
There are currently three ways to install the Eclipse plugin:
(1) Online installation: Use the Eclipse's menu bar, Help, Softwareupdates, Find and install ...--search for new features ... input software Installation Address for installation
(2) Offline installation method One: Download the plugin file, unzip it into the corresponding eclipse directory, the Eclipse directory under the corresponding features and plugins under.
(3) Offline installation Method II: Links file mode.
The first two methods are relatively simple, Baidu experience http://jingyan.baidu.com/article/15622f2454893cfdfcbea5d1.html on the detailed graphic tutorial.
I chose the third way, because it allows the eclipse plugin to be managed in a separate directory, multiple eclipse points can point to the Eclipse plugin directory, and I'll show you how to install the plugin in the third-minute way.
2. Download Plugin
Because FindBugs, Checkstyle, PMD are in http://sourceforge.net/this open-source site to manage, so go directly to the site to download.
Tools |
|
|
considerations |
Findbugs |
http://sourceforge.net/projects/findbugs/files/findbugs%20eclipse%20plugin/ |
|
When downloading to note that the red box must be findbugs Eclipse plugin, it is possible that you downloaded to findbugs on this site, but he cannot use it as an Eclipse plugin. There may be other uses. |
Checkstyle |
http://sourceforge.net/projects/eclipse-cs/ Files/?source=navbar |
http://sourceforge.net/projects/pmd/files/pmd-eclipse/ update-site-latest/ |
|
I didn't find any files to download plugins and features. Only one download can be made, then recreate the features and plugins folders and put the stuff inside. Maybe there's a better way. Also note that the downloaded file is in the Pmd-eclipse directory |
After the download, you can use the installation method described above. Here I describe the third way in detail.
3, install the plug-in
Links Method Installation
The installation directory for my eclipse is D:\Application\eclipse.
The goal is to place the plugin under the D:\Application\eclipse_plugins of the Eclipse folder sibling (the folder name is arbitrary).
Create D:\Application\eclipse_plugins\lunaeclipse under the Eclipse_plugins folder (the folder name is arbitrary), indicating that this is the plug-in used by Lunaeclipse.
Create FindBugs, Checkstyle, and PMD three folders under D:\Application\eclipse_plugins\lunaeclipse (folder name is optional). :
Then create a Eclispe folder (fixed file name) inside the findbugs, the Eclipse folder creates features (file name fixed) and plugins (file name pinned) folder.
Checkstyle and PMD do the same.
The downloaded files (which contain plugins and features) are then placed in the corresponding folder according to the same structure. For example:
FindBugs, Checkstyle, PMD installation and use of the eclipse plugin