To show PMD warnings, the PMD XML needs to put out to the build log.
When Using PMD Command Line
Use the --format xml
flag to print out the PMD analysis into the build log. For example:
pmd --dir $PWD/src/main --rulesets category/java/bestpractices.xml --format xml
When Using PMD via Build System
If you integrate PMD via a build system like Maven, you might now have access to the PMD command line. Typically the build system will generate a PMD report xml, and you can dump that to the console. For example:
#!/bin/bash cat ./target/pmd.xml || echo "No PMD analytics generated"