1
我有問題能夠將節點添加到節點子節點的0索引。Groovy腳本 - 在索引0處將子節點添加爲子節點
我能夠追加一個節點到最後,但無法弄清楚如何在前面找到一個節點。
我的代碼現在看起來像這樣。
def setupProjectXML(workspace, environment, client) {
def projectFile = new XmlParser().parse(new File("${workspace}/jenkinsProject.xml"))
projectFile.appendNode("set", [name : "m4"])
projectFile.appendNode("set", [name : "universalM4"])
projectFile.appendNode("set", [name : "restoreState"])
projectFile.appendNode("set", [name : "staging"])
println(projectFile.toString())
}
我曾嘗試使用新的節點()幾個不同的方式,並添加了一個節點列表,但這個崩潰的腳本,只要我使用節點構造。
此錯誤是
an exception which occurred:
in field collector
in field abnormal
in field outcome
in field body
in field step
in field thread
in field this$0
in field returnAddress
in field parent
in field caller
in field parent
in field parent
in field parent
in field caller
in field parent
in field parent
in field parent
in field caller
in field parent
in field parent
in field caller
in field parent
in field parent
in field parent
in field caller
in field parent
in field parent
in field parent
in field caller
in field parent
in field parent
in field caller
in field parent
in field parent
in field caller
in field parent
in field parent
in field parent
in field caller
in field parent
in field parent
in field caller
in field parent
in field parent
in field caller
in field parent
in field parent
in field parent
in field caller
in field parent
in field parent
in field caller
in field parent
in field parent
in field caller
in field parent
in field parent
in field parent
in field parent
in field caller
in field parent
in field parent
in field caller
in field parent
in field parent
in field parent
in field parent
in field caller
in field parent
in field parent
in field caller
in field parent
in field parent
in field caller
in field parent
in field parent
in field capture
in field def
in field closures
in object [email protected]
Caused: java.io.NotSerializableException: org.codehaus.groovy.control.ErrorCollector
這個唯一的問題是隻要我嘗試使用節點的構造函數,我得到一個錯誤。我通過Jenkins調用這個函數,這可能是爲什麼它不起作用。 發生的異常: 在字段收集器 在字段異常.... –