Hello,
Sorry to hijack this thread, but I am attempting to use the MarkupBuilder
to generate POM aggregators project on the fly from my Jenkins Pipeline.
However, I am also having a security issue when instantiating the
MarkupBuilder:
Scripts not permitted to use new groovy.xml.MarkupBuilder java.io.Writer
You say you have been able to override this. Would you be willing to share
with me how to achieve this?
Thank you
On Tuesday, November 15, 2016 at 12:24:48 PM UTC-5, 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.
>
--
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/63d4680d-4ae5-4920-9a5c-5facb4486eee%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.