Skip to end of metadata
Go to start of metadata

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

Compare with Current View Version History

« Previous Version 3 Next »

To show Checkstyle analysis results, print the Checkstyle result XML to the build log.

When Using Checkstyle Command Line

Use the -f=xml flag to print out the Checkstle analysis into the build log. For example:

java -jar ~/Downloads/checkstyle-9.3-all.jar -c=/sun_checks.xml -f=xml src/main/java/

When Using Maven Checkstyle

The Maven Checkstyle plugin doesn’t support printing the XML into the logs. Instead print the generated target/checkstyle-result.xml file into the build log by a final task:

#!/bin/bash
cat ./target/target/checkstyle-result.xml || echo "No Checkstyle analytics generated"

When Using Gradle Checkstyle

The Gradle Checkstyle plugin doesn’t support printing the XML into the logs. Instead print the generated ./build/reports/checkstyle/main.xml file into the build log by a final task:

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

When Using Checkstyle via other Build System

Typically the build system tool generate a Checkstyle report xml. Dump that to the console by a final task. For example:

#!/bin/bash
cat ./a-build-dir/checkstyle-result.xml || echo "No Checkstyle analytics generated"

  • No labels