Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

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 Maven PMD

The Maven PMD plugin, doesn’t support printing the XML into the logs. Instead print the generated target/pmd.xml file into the build log by a follow up task:

#!/bin/bash
cat ./target/pmd.xml || echo "No PMD analytics generated"

When Using Gradle PMD

The Gradle PMD plugin, doesn’t support printing the XML into the logs. Instead print the generated ./build/reports/pmd/main.xml file into the build log by a follow up task:

#!/bin/bash
cat ./build/reports/pmd/main.xml || echo "No PMD analytics generated"

When Using PMD via Build System

Typically the build system tool generate a PMD report xml, and you can dump that to the console. For example:

#!/bin/bash
cat ./a-build-dir/pmd.xml || echo "No PMD analytics generated"

  • No labels