无法在 Jenkinsfile 中使用 readMavenPom
Cannot use readMavenPom in Jenkinsfile
我正在开发与 Jenkins 2.0 一起使用的 Jenkinsfile。 readMavenPom
方法无法识别。是否缺少某些配置才能使其可用?
我的 Jenkins 文件:
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"
}
当运行时,我得到以下错误:
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]
我需要安装 pipeline-utility-steps
插件。
在使用此步骤之前,请注意 writeMavenPom/readMavenPom 文档中的以下内容:
Avoid using this step and readMavenPom. It is better to use the sh step to run mvn goals
我正在开发与 Jenkins 2.0 一起使用的 Jenkinsfile。 readMavenPom
方法无法识别。是否缺少某些配置才能使其可用?
我的 Jenkins 文件:
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"
}
当运行时,我得到以下错误:
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]
我需要安装 pipeline-utility-steps
插件。
在使用此步骤之前,请注意 writeMavenPom/readMavenPom 文档中的以下内容:
Avoid using this step and readMavenPom. It is better to use the sh step to run mvn goals