gpt4 book ai didi

groovy - Jenkins :${BUILD_LOG,maxLines,escapeHtml} 不工作

转载 作者:行者123 更新时间:2023-12-04 15:56:09 28 4
gpt4 key购买 nike

我正在尝试使用“${BUILD_LOG,maxLines,escapeHtml}”,如下所示:
How can I take last 20 lines from the $BUILD_LOG variable?

不幸的是它对我不起作用。

我收到此错误:

Script1.groovy: 114: expecting anything but ''\n''; got it anyway @ line 114, column 301. arted by user MYUSERNAME



我在这一行的代码是:
          msg.setText("This build (" + build.getFullDisplayName() 
+ " ) contains the following tasks:\n\nTASK\t\t\t IMPLEMENTER:\n"
+ taskList + "\n\n\nLink to this
build: ${BUILD_URL} \n ${BUILD_LOG, maxLines=9999, escapeHtml=false}" );

如果我将其取出以下内容,它会起作用。这就是为什么我的猜测是,“ BUILD_LOG ”不再起作用?

${BUILD_LOG, maxLines=9999, escapeHtml=false}



编辑:
也许作为补充:我正在尝试使用 PreSend groovy 脚本来做到这一点。
因为我正在动态构建电子邮件文本。 ${BUILD_URL}工作正常, ${BUILD_LOG, maxLines=9999, escapeHtml=false}不(对我而言)我正在为此寻找解决方案...... msg对象是一个 java MimeMessage。

谢谢,
丹尼尔

最佳答案

该错误消息通常与未关闭的引号有关,注释以 / 开头而不是 //等。在你的代码中,我唯一能看到的是你的第三行没有正确完成,即在 "\n\n\nLink to this 之后您没有关闭双引号,而是开始一个新行(即 expecting anything but ''\n''

尝试写整行:

msg.setText("This build (" + build.getFullDisplayName() 
+ " ) contains the following tasks:\n\nTASK\t\t\t IMPLEMENTER:\n"
+ taskList + "\n\n\nLink to this build: ${BUILD_URL} \n ${BUILD_LOG, maxLines=9999, escapeHtml=false}" );

或者关闭引号:
msg.setText("This build (" + build.getFullDisplayName() 
+ " ) contains the following tasks:\n\nTASK\t\t\t IMPLEMENTER:\n"
+ taskList + "\n\n\nLink to this "
+ "build: ${BUILD_URL} \n ${BUILD_LOG, maxLines=9999, escapeHtml=false}" );

关于groovy - Jenkins :${BUILD_LOG,maxLines,escapeHtml} 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32697156/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com