我有一类静态变量
class Globals {
static String SLAVE_1_LABEL = 'ruby'
static String SLAVE_2_LABEL = 'python'
static String SLAVE_3_LABEL = 'java'
.....
}
这样做的正确方法是什么:
labelString = Globals.SLAVE_${i}_LABEL ?: "mesos-${Globals.SLAVE_${i}_LABEL}",
Script1.groovy: 145: expecting ')', found '_LABEL' @ line 145, column 53.
obals.SLAVE_${i}_LABEL ?
答案 0 :(得分:0)
Var需要双引号
Globals."SLAVE_${i}_LABEL"