Jenkins maven project violation report in pipeline project

300 Views Asked by At

I am trying to convert jenkins maven project to pipeline project, we have mvn clean install step and next violation plugin can someone help me How to include violation report in pipeline project (check style and findbugs)

enter image description here

1

There are 1 best solutions below

0
On

In declarative style, using the new Warnings Next Generation plugin, you would do something like

pipeline {
    agent any 
    stages {
        ... pre-conditions & other stuff previously handled by your jenkins maven job ...
        stage('Build') {
            steps {
                withMaven {
                    sh 'mvn clean install'
                }
            }
        }
        ... post-conditions previously handled your jenkins maven job ...
    }
    post {
        always {
           recordIssues(
               enabledForFailure: true, aggregatingResults: true, 
               tools: [java(), checkStyle(pattern: 'checkstyle-result.xml', reportEncoding: 'UTF-8'), findBugs(pattern: 'findbugs.xml')]
           )               
        }
    }
}

See the pipeline documentation page for more details about syntax etc