PMD plugin configuration query


(Richard Rodgers) #1

Newbie PMD plugin question. I’m trying to use the Pmd plugin (Gradle 1.5), and am unable to figure out how to configure it. With a ‘build.gradle’ of:

apply plugin: ‘java’

apply plugin: ‘pmd’

repositories {

mavenCentral()

}

if I run the ‘check’ task, I see an empty (0 Files) PMD 4.3 report. So I guess it has no default ‘source’ property value? My java source is in ‘src/main/java/com/example’ which I would think is the expected location. I tried:

Pmd {

source = sourceSets.main.allJava

}

and other variants, but clearly don’t know enough to properly configure. Any simple example appreciated…


(René Groeschke) #2

The pmd plugin adds two tasks (pmdMain for your production and pmdTest for your test code) to your build. your second snippet is not valid as it does not reference an existing task. Normally no further configuration is required. The report is empty if you don’t hit any issues. cheers, René


(Richard Rodgers) #3

Thanks René - it was the lack of issues - it just never occurred to me it could run clean the first time I tried it!

Richard