一尘不染

java.lang.NoSuchMethodError:没有这样的DSL方法“ readJSON”

jenkins

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。

任何想法如何解决这个问题?

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,

阅读 1174

收藏
2020-07-25

共1个答案

一尘不染

使用管道实用程序步骤插件可以使用该readJSON功能。

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

没有此插件,您将无法使用此功能。

有关更多信息,请检查:步骤

2020-07-25