-1

How get number of warnings from PMD with Jenkins Pipeline?. I have tried but can not find a way to fix this

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
JuanG
  • 1
  • 1
  • You should look at https://github.com/jenkinsci/pipeline-plugin/blob/master/COMPATIBILITY.md#plugin-developer-guide The pmd plugin is not supported yet – Beuj Sep 07 '16 at 12:58
  • @Beuj: PMD plugin is already supported, check my answer – Marek Skiba Oct 12 '17 at 10:31

2 Answers2

1

Here is my Code Analysis block stage:

stage('CAT') {

    step([$class: 'hudson.plugins.checkstyle.CheckStylePublisher', checkstyle: '**/target/checkstyle-result.xml'])

    step([$class: 'hudson.plugins.pmd.PmdPublisher', checkstyle: '**/target/pmd.xml'])

}
ddb
  • 2,423
  • 7
  • 28
  • 38
Khmelevskikh Alex
  • 131
  • 1
  • 1
  • 5
1

This is how I handle PMD in Jenkinfile (PHP project):

stage('PMD') {
    steps {
        sh 'vendor/bin/phpmd . xml build/phpmd.xml --reportfile build/logs/pmd.xml --exclude vendor/ || exit 0'
        pmd canRunOnFailed: true, pattern: 'build/logs/pmd.xml'
    }
}
Reference links
Justin Wrobel
  • 1,981
  • 2
  • 23
  • 36
Marek Skiba
  • 2,124
  • 1
  • 28
  • 31