Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Gradle PMD plug-in


May 25, 2021 Gradle


Table of contents


PMD plug-in

The PMD plug-in uses PMD to perform a quality check on the project's Java source file and generate a report from the results of the check.

Usage

To use the PMD plug-in, include the following statement in the build script:

Use the PMD plug-in

build.gradle

apply plugin: 'pmd'  

The plug-in adds a lot of quality checks to your project. You can perform a check by running the gradle check.

Task

The PMD plug-in adds the following tasks to the project:

Table 33.1. PMD plug-in - task

The name of the task Depends on Type Describe
pmdMain - Pmd Run PMD for production Java source files.
pmdTest - Pmd Run PMD against the test Java source file.
SourceSet - Pmd Run PMD on the Java source file for source set.

The PMD plug-in adds the following dependencies to the tasks that the Java plug-in joins.

Table 33.2. PMD plug-in - additional task dependency

The name of the task Depends on
check All PMD tasks, pmdTest

Rely on management

The PMD plug-in adds the following dependency configurations:

Table 33.3. PMD Plug-in - Dependent on configuration

Name Significance
pmd The PMD library used