简体   繁体   English

Jenkins groovy post build插件使用什么版本的Groovy?

[英]What version of Groovy is the Jenkins groovy post build plugin using?

I have the Groovy and Groovy Postbuild plugins installed in Jenkins (1.554) and have it set to automatically install Groovy 2.2.1 when needed. 我在Jenkins(1.554)中安装了Groovy和Groovy Postbuild插件,并将其设置为在需要时自动安装Groovy 2.2.1。

After having a problem with a constructor signature I dug a little deeper and round that Jenkins is actually using 1.8.9 by running this through the groovysh CLI. 在遇到构造函数签名的问题后,我通过groovysh CLI运行它,进一步深入地了解了Jenkins实际上使用的是1.8.9。

groovy> import org.codehaus.groovy.runtime.InvokerHelper
groovy> println InvokerHelper.version

It appears that the groovy post build plugin is also using 1.8.9 based on the error message I get when I try to run my script. 看来,根据我在尝试运行脚本时收到的错误消息,groovy post build插件也正在使用1.8.9。

How can I update this? 我该如何更新? I have already set the groovy plugin to use 2.2.1. 我已经将groovy插件设置为使用2.2.1。 Thanks! 谢谢!

Groovy Postbuild plugins use the groovy version included in Jenkins (1.8.9). Groovy Postbuild插件使用Jenkins(1.8.9)中包含的groovy版本。 You can't change it. 您无法更改。

The problem is the same as the system script in Groovy Plugin . 问题与Groovy插件中的系统脚本相同。

If you need a newer version of groovy a workaround is to do your work in a build (like Groovy Plugin purpose). 如果您需要较新版本的groovy,则一种解决方法是在构建中进行工作(例如Groovy Plugin目的)。 Write some informations in a text file. 在文本文件中写一些信息。 And Read it in Post build step to do what you want with jenkins context (create badge, add summary, etc.) 然后在Post构建步骤中阅读它,以使用jenkins上下文执行您想要的操作(创建徽章,添加摘要等)。

Note that you can access to build workspace in post build step with: 请注意,您可以使用以下命令在构建后的步骤中访问构建工作区:

manager.build.project.getWorkspace()

Hope it helps. 希望能帮助到你。

我将Groovy v2.4.3安装到/usr/share/groovy ,然后在我的jenkins生成后任务中,将我的脚本引用为/usr/bin/groovy myscript.groovy类似于@passionne的描述。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM