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

时间:2017-10-20 03:12:43

标签: json jenkins groovy continuous-integration jenkins-pipeline

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, 

3 个答案:

答案 0 :(得分:12)

使用Pipeline Utility Steps Plugin您可以使用.NSMetadataQueryDidUpdate功能。

dataSource: this.state.dataSource.cloneWithRows(JSON.parse(response.getB‌​odyString()))

如果没有此插件,则无法使用此功能。

有关详情,请查看:Steps

答案 1 :(得分:7)

安装Pipeline Utility Steps插件。

答案 2 :(得分:0)

在我的情况下,这只是一个愚蠢的错字:readJson而不是readJSON。