jon
jon

Reputation: 263

Unable to publish spotbugs in jenkins using pipeline script

I am running spotbugs through an Ant task but I am unable to publish the results to jenkins. I am getting the below error

[FindBugs] No valid reference build found that meets the criteria (NO_JOB_FAILURE - SUCCESSFUL_QUALITY_GATE)
[FindBugs] All reported issues will be considered outstanding

This is the jenkins script I am using

stage('Publish Spotbugs')
            {
                def findbugs = scanForIssues tool: [$class: 'FindBugs'], pattern: '**/findbugsXml.xml'
                publishIssues issues:[findbugs]
            }

Upvotes: 1

Views: 2279

Answers (1)

Matthias
Matthias

Reputation: 323

You wrote that you are using Spotbugs. In your pipeline you are using the Findbugs Publisher. Spotbugs is a Findbugs fork. If you really are using Spotbugs I recomend to use the Spotbugs Publisher instead.

stage('Publish Spotbugs')
{
  def spotbugs = scanForIssues tool: spotBugs(pattern: '**/target/findbugsXml.xml')
  publishIssues issues: [spotbugs]
}

The report-XML filename depends on your configuration. It could also be spotbugsXml.xml. Have you verified your target folder after running the ant task?

For more information about the pipeline configuration of the Warnings Next Generation Plugin see the documentation on github or the jenkins user documtation.

Upvotes: 2

Related Questions