Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot use readMavenPom in Jenkinsfile

I am working on a Jenkinsfile for use with Jenkins 2.0. The readMavenPom method is not recognized. Is there some configuration I am missing to make this available?

My Jenkinsfile:

node {   stage 'Checkout'   checkout scm   env.PATH = "${tool 'maven-3'}/bin:${env.PATH}"   stage 'Build'   def pom = readMavenPom file: 'pom.xml'   echo "${pom}"   sh "mvn -DskipTests=true verify" } 

When run, I get the following error:

java.lang.NoSuchMethodError: No such DSL method 'readMavenPom' found among [AWSEBDeployment, archive, bat, build, catchError, checkout, deleteDir, dir, echo, emailext, error, fileExists, git, input, isUnix, load, mail, node, parallel, properties, pwd, readFile, retry, sh, slackSend, sleep, stage, stash, step, svn, timeout, tool, unarchive, unstash, waitUntil, withCredentials, withEnv, wrap, writeFile, ws] 
like image 730
oillio Avatar asked May 12 '16 20:05

oillio


People also ask

What does checkout SCM do in Jenkinsfile?

The checkout step will checkout code from source control; scm is a special variable which instructs the checkout step to clone the specific revision which triggered this Pipeline run.

Can we change Jenkinsfile name?

On the project section of the configuration page you just have to click Add > Pipeline Jenkins and then you can choose the custom name that jenkins will look for the pipeline.

What file type is a Jenkinsfile?

A Jenkinsfile is a text file that contains the definition of a Jenkins Pipeline and is checked into source control. Consider the following Pipeline which implements a basic three-stage continuous delivery pipeline.

What syntax is Jenkinsfile?

A Jenkinsfile can be written using two types of syntax - Declarative and Scripted. Declarative and Scripted Pipelines are constructed fundamentally differently. Declarative Pipeline is a more recent feature of Jenkins Pipeline which: provides richer syntactical features over Scripted Pipeline syntax, and.


1 Answers

I needed to install the pipeline-utility-steps plugin.

like image 183
oillio Avatar answered Oct 19 '22 03:10

oillio