Piyushbhai Sadseliya
Piyushbhai Sadseliya

Reputation: 11

unexpected behavior of jenkins pipeline script with findbugs plugin

first configuration:

stage('bug') 
     { bat 'mvn findbugs:findbugs'
       bat'mvn test'
       findbugs canComputeNew: false, defaultEncoding: '', excludePattern: 
       '', healthy: '', includePattern: '', pattern: 
       '**/target/findbugsXml.xml', unHealthy: ''
     }

It works properly in the local environment. local is Windows! But doesn't work in production (RedHat)

second configuration:

step([$class: 'FindBugsPublisher', 
pattern:'C:\\Users\\ADMIN\\.jenkins\\workspace\\pipeline\\target\\findbugsXml.xml', unstableTotalAll:'0'])

This works in the local (Windows) as well as production once I take care about '\\'.

Pipeline is also compatible with the plugin I'm using.
I want to know why first configuration is not working in production, when second configuration works in both environment.

First configuration throws build failure with error:

No Such DSL method findbugs found.

Can anyone please help me out with this?

Upvotes: 1

Views: 566

Answers (1)

VonC
VonC

Reputation: 1328562

In the Pipeline: Nodes and Processes, a bat step executes a Executes Windows Batch script, not a Linux (RedHat or otherwise)

For ReadHat, replace bat with sh.

That differs from the Pipeline Maven Integration Plugin, which will translate the maven call into bat or shell process, depending on the execution OS.

Upvotes: 1

Related Questions