Configuring Groovy on Jenkins

≯℡__Kan透↙ 提交于 2020-01-06 06:37:29

问题


I'm using Jenkins ver 2.121.2. I'm trying to configure the Groovy plugin to run groovy scripts via a Jenkins job. The plugin documentation provided here

does not appear to match the UI I see in the System Configuration - Groovy section of this version of Jenkins. The various parameters don't match and so far I'm unable to get the plugin to run a simply groovy script. Not being familar with java and how the classpath works I'm not able to loosely interpret the instructions and get it working. If anyone can point me at documentation that more closely matches the Groovy plugin with the most current version of Jenkins I would appreciate it.


回答1:


First, you need to configure an instance (or instances) of Groovy to run scripts in your builds. You do that on the Global Tool Configuration page.

You should have a least one JDK configured in the Global Tools Configuration (or have JAVA_HOME defined).

You can have Jenkins install the version of Groovy you want (on first use), or you can install Groovy yourself and point to it as in the example below:

Once this is in place, you can use the Execute Groovy Script build step in a build:



来源:https://stackoverflow.com/questions/51584368/configuring-groovy-on-jenkins

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!