In my Jenkinsfile, I'm trying to use MarkupBuilder to construct a simple 
XML message. I first discovered that there are default security 
restrictions preventing the use of this class, which I was able to override.

Next, I'm seeing errors that make it seem like the "methodMissing" calls 
for XML elements within the MarkupBuilder DSL are going to the Pipeline DSL 
instead.  I'm able to verify my method works in groovyConsole, but when I 
run the job in Jenkins, I get an error like this:

java.lang.NoSuchMethodError: No such DSL method 'statement' found among steps 
[VersionNumber, archive, ...


Where my method looks like this:
def constructMessageXML(String qid, String qpassword, String contactID, 
String text, boolean isMeeting) {
    def writer = new StringWriter()
    MarkupBuilder mb    = new MarkupBuilder(writer)
    mb.message (type:"contact.send.message", id:qid, password:qpassword, 
contactId:contactID) {
        statement (isMeeting ? [from:qid, to:contactID, text:text, type:
"meeting"] : [from:qid, to:contactID, text:text]) {}
    }
    return writer.toString()
}


The list of steps from the error message are clearly from the Pipeline DSL, 
not the MarkupBuilder DSL.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/e3adf2f8-9615-47c6-bf96-8265b63aa094%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to