2016-09-06 77 views
-1

如何從Jenkins Pipeline獲得PMD警告的數量? 我都試過,但不能找到一種方法來解決這個問題從Jenkins Pipeline獲得PMD警告

+0

你應該看看https://github.com/jenkinsci/pipeline-plugin/blob/master/COMPATIBILITY.md#plugin-developer-guide pmd插件還不支持 – Beuj

+0

@Beuj:PMD插件已經被支持,check我的答案 –

回答

1

這是我的代碼分析塊階段:

stage('CAT') { 

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

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

} 
0

這是我如何處理PMD在Jenkinfile(PHP項目):

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' 
    } 
}