我正在尝试从管道脚本中的 xml 文件中读取服务器名称。
我的代码:
node {
def str = "<root><HTTPTargetConnection><Loadbalancer><server name=\"myserver\" /> </Loadbalancer></HTTPTargetConnection></root>";
def rootNode = new XmlParser().parseText(str);
echo rootNode.HTTPTargetConnection.Loadbalancer.server.@name.value[0];
}
例外: [管道] 管道结束 *
org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException:在 org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.unclassifiedField(SandboxInterceptor.java:367) 在 org.jenkinsci.plugins 的未分类字段 groovy.util.Node HTTPTargetConnection。 scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(SandboxInterceptor.java:363) at org.kohsuke.groovy.sandbox.impl.Checker$4.call(Checker.java:241)
请帮我解决这个问题。