To install the latest version, add the following to the lib/bld/bld-wrapper.properties file:
bld.extension-pmd=com.uwyn.rife2:bld-pmdFor more information, please refer to the extensions documentation.
To check the project's source code using the default Java Quickstart configuration, add the following to your build file:
@BuildCommand(summary = "Checks source code with PMD")
public void pmd() throws Exception {
new PmdOperation()
.fromProject(this)
.execute();
}./bld clean compile pmd testThe output might look something like:
Executing matched command: clean
Cleaning finished successfully.
Executing matched command: compile
Compilation finished successfully.
Sep 17, 2026 8:47:54 AM rife.bld.extension.PmdOperation execute
INFO: Running PMD analysis...
Sep 17, 2026 8:47:55 AM rife.bld.extension.PmdOperation performAnalysis
INFO: inputPaths[/home/dev/readme/src/main, /home//dev/readme/src/test]
Sep 17, 2026 8:47:55 AM rife.bld.extension.PmdOperation performAnalysis
INFO: ruleSets[rulesets/java/quickstart.xml]
Sep 17, 2026 8:47:55 AM rife.bld.extension.PmdOperation printViolations
WARNING: file:///home/dev/readme/src/main/java/com/example/ReadMe.java:10
UnusedLocalVariable (https://docs.pmd-code.org/pmd-doc-7.27.0/pmd_rules_java_bestpractices.html#unusedlocalvariable)
--> Avoid unused local variables such as 't'.
Sep 17, 2026 8:47:55 AM rife.bld.extension.PmdOperation printViolations
WARNING: 1 rule violations were found. See the report at: file:///home/dev/readme/build/pmd/pmd-report.txt
Sep 17, 2026 8:47:55 AM rife.bld.extension.PmdOperation performAnalysis
INFO: 122 rules were checked.To check the main source directory using a custom ruleset, Java Error Prone configuration, and failing on any violation.
@BuildCommand(value = "pmd-main", summary = "Checks main source code with PMD")
public void pmdMain() throws Exception {
new PmdOperation()
.failOnViolation(true)
.inputPaths(srcMainDirectory())
.ruleSets("config/pmd.xml", "category/java/errorprone.xml")
.fromProject(new BaseProject())
.execute();
}./bld clean compile pmd-mainPlease check the PmdOperation documentation for all available configuration options.