如何使用设置好的变量Config.groovy中并连接它
问题描述:
我想重用Config.groovy中一次设置好的稍后再瓦尔如何使用设置好的变量Config.groovy中并连接它
例子:
static.serverURL = "http://static.foo.com"
static.path = ""
bar.default.picUrl=static.serverURL+static.path+"/images/bar.png"
但给了我一个
groovy.util.ConfigObject.plus() is applicable for argument types: (java.lang.String)
将其更改为
bar.default.picUrl=""+static.serverURL+static.path+"/images/bar.png"
给我
[:][:]/images/bar.png
使用
bar.default.picUrl=${static.serverURL}+${static.path}+"/images/bar.png"
给我
nullnull/images/bar.png
答
你尝试:
bar.default.picUrl="${static.serverURL}${static.path}"/images/bar.png