在groovy脚本中的Email-Ext对象作为文件 [英] Email-Ext objects in groovy script as file
问题描述
我的问题是这样的后续行动:
如何在jenkins文件系统上放置Email-Ext groovy脚本
这是我的情况:
我有一个groovy脚本,它构造了将要发送的电子邮件。
只要我将脚本直接写入(代码),就可以正常工作:
预发送脚本 p>
如果我把这个脚本放在Jenkins文件系统中(... jenkins \\ \\电子邮件模板)为:电子邮件presend.groovy 和我尝试调用它:
< presendScript> $ {SCRIPT,script =email-presend}< / presendScript>
我得到错误消息,我无法访问消息对象:
Script1.groovy:1:期待EOF,找到'或'@第1行,第17列。
脚本或模板错误:groovy.lang .MissingPropertyException:No such property:msg for class:Script1
行上的代码:
msg.addHeader(X-Priority,1(Highest));
msg.addHeader(重要性,高);
我错过了一些明显的东西,找到任何代码片段,这是否做到了这一点?
我想使用javax.mail.Message msg,如果代码直接在jenkins中,则可用。
Email-ext comment
太糟糕了:(
)My question is kind of a follow up of this: How to place Email-Ext groovy script on the jenkins file system
Here is my situation: I have a groovy script which constructs the email which will be send. This works fine as long as I have the script directly written (the code) in:
Pre-send Script
If I take this script, place it in the Jenkins filesystem(...jenkins\email-templates) as: email-presend.groovy and I try to call it with:
<presendScript>${SCRIPT, script="email-presend"}</presendScript>
I get the error message, that I can't access the message object:
Script1.groovy: 1: expecting EOF, found 'or' @ line 1, column 17. Error in script or template: groovy.lang.MissingPropertyException: No such property: msg for class: Script1
Code on the line:
msg.addHeader("X-Priority", "1 (Highest)");
msg.addHeader("Importance", "High");
Am I missing something obvious, since I can't find any code snippet which did this? I want to use the javax.mail.Message msg which is available if the code is directly in jenkins.
Unfortunately it seems like it's not possible according to this post: Email-ext comment
Too bad :(
这篇关于在groovy脚本中的Email-Ext对象作为文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!