Checkstyle and PMD plugins

We have seen how simple it is to create a Gradle build job in Jenkins. We will now add Checkstyle and PMD plugins to our project for quality checking purposes. There are different approaches that we can follow in order to use these plugins. We can directly add these plugins to Jenkins and run it for our project, or we can use Gradle Checkstyle and PMD plugins and evaluate the project.

We will use the Gradle approach to add Checkstyle and PMD plugins for code quality check, and execute this using Jenkins. Let's create two Gradle files, one for Checkstyle and the other for PMD:

build_checkstyle.gradle

apply plugin: 'groovy' apply plugin: 'eclipse' apply plugin: 'checkstyle' version = '1.0' repositories { mavenCentral() ...

Get Mastering Gradle now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.