无法在 Jenkinsfile 中使用 readMavenPom [英] Cannot use readMavenPom in Jenkinsfile

查看:26
本文介绍了无法在 Jenkinsfile 中使用 readMavenPom的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个用于 Jenkins 2.0 的 Jenkinsfile.readMavenPom 方法无法识别.我是否缺少一些配置以使其可用?

我的 Jenkins 文件:

node {阶段结帐"结帐单片机env.PATH = "${tool 'maven-3'}/bin:${env.PATH}"阶段构建"def pom = 读取 MavenPom 文件:'pom.xml'回声${pom}"sh "mvn -DskipTests=true 验证"}

运行时出现以下错误:

<块引用>

java.lang.NoSuchMethodError: No such DSL method 'readMavenPom' found between[AWSEBDeployment,存档,bat,构建,catchError,结帐,deleteDir,dir,echo,emailext,错误,fileExists,git,输入,isUnix,加载,邮件,节点,并行,属性,密码,读取文件,重试,sh,slackSend,睡眠,阶段,存储,步骤,svn,超时,工具,取消归档,unstash,waitUntil,withCredentials,withEnv,wrap,写文件,ws]

解决方案

我需要安装 pipeline-utility-steps 插件.

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]

解决方案

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

这篇关于无法在 Jenkinsfile 中使用 readMavenPom的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆