Output of pmd task not on console

Taking the example for the gradle book (ant-customtaskuse\build.gradle) we set the output of the ant.pmdtask toConsole=true.

however I do not get the output. I only get it if i invoke gradle with --info option.

what is going wrong here ?


// PMD example using a configuration and Gradle dependency
// management to control the loading of the Ant Task.
configurations {

dependencies {
myPmd group: ‘pmd’, name: ‘pmd’, version: ‘4.2.5’

repositories {

task checkThePMD << {
ant.taskdef(name: ‘myPmdTask’, classname: ‘net.sourceforge.pmd.ant.PMDTask’, classpath: configurations.myPmd.asPath)
ant.myPmdTask(shortFilenames: ‘true’, failonruleviolation: ‘true’,
rulesetfiles: file(‘src/tools/pmd-basic-rules.xml’).toURI().toString()) {
formatter(type: ‘text’, toConsole: ‘true’)
fileset(dir: ‘src/main/java’)

I’d just go with the Gradle core PMD plugin. The following code in conjunction with the plugin should do the trick:

pmd {
    consoleOutput = true