2016-05-12 73 views
11

我正在爲Jenkins 2.0使用Jenkinsfile。 readMavenPom方法無法識別。有沒有一些配置我錯過,使其可用?不能在Jenkinsfile中使用readMavenPom

我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" 
} 

運行時,我收到以下錯誤:

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] 

回答

23

我需要安裝插件pipeline-utility-steps