Jenkins' PMD Plugin - How to show report on build failure?

Viewed 1147

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.

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. http://jenkins-ci.361315.n4.nabble.com/pmd-post-build-publishing-after-failing-build-td376948.html

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.

Jenkins console log (print screen because of VM): enter image description here

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.

enter image description here

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:

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()
}
1 Answers
Related