I am currently trying to implement pipeline in jenkins using jenkinsfile and i am executing a maven project on windows machine. I am creating a pipeline job in jenkins and i have checked in this file in my github repository and when i am running the job in jenkins , i am getting following error.
My jenkinsfile:
pipeline {
agent any
stages {
stage('Compile stage') {
steps {
maven(maven : 'Maven_3.5.2'){
bat "mvn clean compile"
}
}
}
stage('testing stage') {
steps {
maven(maven : 'Maven_3.5.2'){
bat "mvn test"
}
}
}
stage('deployment stage') {
steps {
maven(maven : 'Maven_3.5.2'){
bat "mvn deploy"
}
}
}
}
}
I am getting below error when i am running it through jenkins job- Jenkins error:
java.lang.NoSuchMethodError: No such DSL method 'withMaven' found among steps [archive, bat, build, catchError, checkout, deleteDir, dir, dockerFingerprintFrom, dockerFingerprintRun, echo, emailext, emailextrecipients, envVarsForTool, error, fileExists, getContext, git, input, isUnix, library, libraryResource, load, mail, milestone, node, parallel, powershell, properties, pwd, readFile, readTrusted, resolveScm, retry, script, sh, sleep, stage, stash, step, svn, timeout, timestamps, tm, tool, unarchive, unstash, validateDeclarativePipeline, waitUntil, withContext, withCredentials, withDockerContainer, withDockerRegistry, withDockerServer, withEnv, wrap, writeFile, ws] or symbols [all, allOf, always, ant, antFromApache, antOutcome, antTarget, any, anyOf, apiToken, architecture, archiveArtifacts, artifactManager, authorizationMatrix, batchFile, booleanParam, branch,
Any help?