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]
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.
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.
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.
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.
I needed to install the pipeline-utility-steps
plugin.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With