On Tuesday, November 15, 2016 at 9:24:48 AM UTC-8, David Karr wrote:
>
> 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.
>

I've managed to resolve this.  Changing "statement" to "delegate.statement" 
gets past this. 

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/a7772e82-ae9c-45b9-a6fb-a642ae5645df%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to