I don’t think that you can use plain Groovy code in Jenkins, only a subset of Groovy is supported. XML processing and similar complex steps should be done in a specific plugin.
def text = '''
<list>
<technology>
<name>Groovy</name>
</technology>
</list>
'''
def list = new XmlSlurper().parseText(text)
println list.technology.name.text()
Using a GPath expression like this list.technology.name.text() works fine but requires an admin to allow “method groovy.lang.GroovyObject getProperty java.lang.String” which the script security plugin recommends against (“Approving this signature may introduce a security vulnerability! You are advised to deny it.”). Since I am not the owner of the Jenkins instance, I am not sure I can convince them this is OK to approve.
Is there a way to write the code such that it does not depend on GroovyObject.getProperty being permitted? Or is there someway to configure Jenkins so that this can work? Or how to proceed ahead with it?
Is there a way to write the code such that it does not depend on GroovyObject.getProperty being permitted? Or is there someway to configure Jenkins so that this can work? Or how to proceed ahead with it?
Our applications consists of pom.xml file and from that xml file we need to fetch the available information and perform further processing on it. Therefore, we need to parse the XML.