title: Jenkins' PMD Plugin - How to show report on build failure?
body: <p>I'm trying to use the PMD plugin for Jenkins. Everything works fine except for one thing. When the Jenkins build fails, the reports in the build won't update. This could be a problem because if you've got a critical error in your code, you have to go to the workspace manually and read the .xml file (which is generated by PMD) to see what your error is.</p>
  
  <p>I found someone who had the same problem, however this post was last updated in 2009. At the end of the post you can see that someone explains that this isn't a feature yet. <a href="http://jenkins-ci.361315.n4.nabble.com/pmd-post-build-publishing-after-failing-build-td376948.html" rel="nofollow noreferrer">http://jenkins-ci.361315.n4.nabble.com/pmd-post-build-publishing-after-failing-build-td376948.html</a></p>
  
  <p>I can confirm that he pmd results are being generated, because I can see them in my Jenkins' workspace. However, the reports won't show up in the build.</p>
  
  <p>Jenkins console log (print screen because of VM):
  <a href="https://i.stack.imgur.com/YHWUE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YHWUE.png" alt="enter image description here"></a></p>
  
  <p>As you can see here, the Jenkins build failed because of a PMD rule violation. Which is good, however when we go to the build, you can't see the PMD report.</p>
  
  <p><a href="https://i.stack.imgur.com/NQWIO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NQWIO.png" alt="enter image description here"></a></p>
  
  <p>I already installed the PMD plugin in Jenkins, and this used to work until I changed the ruleviolation. You can see my gradle's code for PMD here:</p>
  
  <pre><code>task pmd (type: Pmd) {
  
  ignoreFailures = false
  description 'Run pmd'
  group 'verification'
  rulePriority = 2
  
  ruleSets = ["java-android",
              "java-basic",
              "java-braces",
              "java-strings",
              "java-design",
              "java-unusedcode"]
  source = fileTree('src/main/java')
  
  reports {
      xml.enabled = true
      html.enabled = false
     }
  }
  
  check.doLast {
      project.tasks.getByName("pmd").execute()
  }
  </code></pre>