html tool

2021年4月7日星期三

解决:MissingPropertyException: No such property: props for class: groovy.lang.Binding

 https://stackoverflow.com/questions/63975674/groovy-lang-missingpropertyexception-no-such-property-props-for-class-groovy

问题:MissingPropertyException: No such property: props for class: groovy.lang.Binding

code: jenkins-pipeline

def jobes = [:]

def lists=["xls","doc","ole","exe86"]

/*def res_dic = readJSON text: '''

{

    "xls":"xls/as",

    "doc":"doc/as",

    "ole":"ole/as",

    "exe86":"exe86/as"

}

'''

*/

node("192.168.120.100"){

    def props = readJSON file: '/home/sandbox/lj_test/code_backup/input.json'

}

def total=lists.size()

for (int i = 20; i >15; i--) {

//for (i in lists){

  def sandbox_id = i

  def sample=lists[i-20]

  def res_d = res_dic["${sample}"]

  def props_d = props["${sample}"]

解决:

Your definition of the variable props is inside the try-catch:

try {
    def props =  readJSON text: env.hb_job_params
    ...
}

But later, you try to use it in props.get(application_server) and that variable does not exist anymore at that point


修改后:

def jobes = [:]

def lists=["xls","doc","ole","exe86"]

/*def res_dic = readJSON text: '''

{

    "xls":"xls/as",

    "doc":"doc/as",

    "ole":"ole/as",

    "exe86":"exe86/as"

}

'''

*/

def props = readJSON text: """ {} """

node("192.168.120.100"){

    props = readJSON file: '/home/sandbox/lj_test/code_backup/input.json'


}

def total=lists.size()

for (int i = 20; i >15; i--) {

//for (i in lists){

  def sandbox_id = i

  def sample=lists[i-20]

  def res_d = res_dic["${sample}"]

  def props_d = props["${sample}"]

...

没有评论:

发表评论