A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.pmd-code.org/latest/pmd_userdocs_tools_gradle.html below:

Gradle | PMD Source Code Analyzer

Table of Contents

The Gradle Build Tool provides a PMD Plugin that can be added to your build configuration. Technically it is based on the Ant Task.

Example

In your build.gradle add the following:

Custom ruleset

Configuration of a custom ruleset looks like this:

pmd {
    ruleSetFiles = files("custom-pmd-ruleset.xml")
    ruleSets = []
}

Note: The ruleSets array is explicitly set to empty to avoid using the default configuration.

Fail the build

If you want to fail the build for pmd violations, you need to set ignoreFailures:

pmd {
    ignoreFailures = false
}

More configuration options are documented on PMD Extension.

Upgrade PMD version

If you want to use a newer PMD version than the default one provided with gradle, you can do so with the property toolVersion:

pmd {
    toolVersion = "7.16.0"
}

Note: For PMD 7, at least gradle 8.6 is needed. See Support for PMD 7.0.

References

Source code for Gradle’s PMD Plugin is available here:


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4