Book Image

Mastering Gradle

Book Image

Mastering Gradle

Overview of this book

Table of Contents (17 chapters)
Mastering Gradle
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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()
}
checkstyle {
  toolVersion = 6.5
  ignoreFailures = true
}


dependencies {
  compile gradleApi()
  compile localGroovy()
  compile group: 'commons-collections', name: 'commons-collections', version: '3.2'
  testCompile group: 'junit', name:...