java.lang.NoSuchMethodError:没有这样的 DSL 方法“readJSON" [英] java.lang.NoSuchMethodError: No such DSL method 'readJSON'

查看:22
本文介绍了java.lang.NoSuchMethodError:没有这样的 DSL 方法“readJSON"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

def data = readJSON text: '{"rel" : {"configVersion": "1.0","manifest" :"'+"${manifestURL}"+'"}}'
writeJSON(file: 'C:\Users\Public\json\config.json', json: data)

我在我的 Jenkins 管道中使用 JSON 函数并得到 NoSuchMethodFoundError.我正在使用 Jenkins 2.85.

I am using JSON function in my Jenkins pipeline and getting NoSuchMethodFoundError. I am using Jenkins 2.85.

知道如何解决这个问题吗?

Any idea how to resolve this issue?

java.lang.NoSuchMethodError: No such DSL method 'readJSON' 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, buildButton, buildDiscarder, 
caseInsensitive, caseSensitive, certificate, changelog, changeset, choice, 
choiceParam, cleanWs, clock, cloud, command, credentials, cron, crumb, 
defaultView, demand, disableConcurrentBuilds, docker, dockerCert, 
dockerfile, downloadSettings, downstream, dumb, envVars, environment, 
expression, file, fileParam, filePath, fingerprint, frameOptions, freeStyle, 
freeStyleJob, fromScm, fromSource, git, github, githubPush, gradle, 
headRegexFilter, headWildcardFilter, hyperlink, hyperlinkToModels, 
inheriting, inheritingGlobal, installSource, jdk, jdkInstaller, jgit, 
jgitapache, jnlp, jobName, junit, label, lastDuration, lastFailure, 
lastGrantedAuthorities, lastStable, lastSuccess, legacy, legacySCM, list, 
local, location, logRotator, loggedInUsersCanDoAnything, masterBuild, maven, 
maven3Mojos, mavenErrors, mavenMojos, mavenWarnings, modernSCM, myView, 
node, nodeProperties, nonInheriting, 

推荐答案

使用 Pipeline Utility Steps Plugin 你可以使用 readJSON 函数.

Using Pipeline Utility Steps Plugin you can use the readJSON function.

def props = readJSON text: '{ "key": "value" }'

没有这个插件你不能使用这个功能.

You can not use this function without this plugin.

更多信息检查:步骤

这篇关于java.lang.NoSuchMethodError:没有这样的 DSL 方法“readJSON"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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