Plugin Information
This plugin adds the ability to directly execute Groovy code. ConfigurationTo configure available Groovy installation on your system, go to Hudson configuration page, find section 'Groovy' and fill the form as shown bellow.
UsageTo create Groovy-based project, add new free-style project and select "Execute Groovy script" in the Build section, select previously configured Groovy installation and then type your command, or specify your script file name. In the second case path taken is relatively from the project workspace directory.
The plugin also adds the functionality of the Script Console to the project configuration page. You can schedule your system management script...
...and then observe progress in the build log.
ChangelogRelease 1.2:
Known bugs
|





Comments (7)
Apr 01, 2008
scott armit says:
Thanks for this plugin. I've found one issue however (Windows server); if the pa...Thanks for this plugin. I've found one issue however (Windows server); if the path to a groovy script passes args, then the full string is quoted. For example, in the "Groovy script file" field, you may have, "build.groovy one two" ('one' and 'two' being args).
The call to groovy.bat will look like, C:\Groovy-1.5.4\bin\groovy.bat "c:\hudson\jobs\groovy\workspace\build.groovy one two"
The result is an exception because groovy.bat processes everything in quotes as one long filename:
Caught: java.io.FileNotFoundException: C:\hudson\jobs\groovy\workspace\build.groovy one two (C:\hudson\jobs\groovy\workspace\build.groovy one two
There is a hacky workound, after your build script name, put double quotes. In my example, build.groovy" one two . This closes the first double-quote, and the last added one gets ignored.
Thanks
Apr 01, 2008
David Vrzalik says:
Yep, the file field isn't intended for script parameters. Next version should le...Yep, the file field isn't intended for script parameters. Next version should let you specify parameters without any hacks.
Apr 02, 2008
scott armit says:
Ok, thank you for the information. One other thing I found if you're interested....Ok, thank you for the information. One other thing I found if you're interested. Apparently 'groovy.bat' does not handle return codes well. So if you System.exit(1) for instance out of your 'groovy' code, Hudson will still report SUCCESS. It's not Hudson's fault, but groovy.bat. Some notes on the groovy web site mention that using the native launcher fixes this (groovy.exe versus groovy.bat). I downloaded your src and changed ".bat" to ".exe" and built the 'hpi' and it works such that my return codes are not ignored.
Regards and thanks again for this plugin!
Apr 02, 2008
David Vrzalik says:
Thanks, I don't use Windows so I don't have much chance to catch these problems....Thanks, I don't use Windows so I don't have much chance to catch these problems. I updated the code to use groovy.exe.
Apr 02, 2008
scott armit says:
Wow, thanks for the fast fix. I'm mostly a linux guy, but have to support some W...Wow, thanks for the fast fix. I'm mostly a linux guy, but have to support some Windows stuff. Speaking of, I tried out the plugin on linux, and tried my "hack" to pass parameters, but linux being stricter about quotes, the hack doesn't work. So I added a scriptArgs textbox under the scriptFile textbox and it works great. I tested giving the path to a groovy file with spaces in it on windows, and it quoted properly: e.g. <path-to-groovy.exe> "C:\Documents and Settings\user\build.groovy" -option1 -option2
The code is a little hacky as it's my first attempt at the plugin code, but I can get it to you if you're interested. Thanks again.
Jul 13
jvizueta says:
I want to access a project's parameters from the "This build is parameteri...I want to access a project's parameters from the "This build is parameterized" option in the project configuration page, how can I get this done?
Thank you
Regards
Sep 10
ali raza says:
How can I configure groovy in hudson. My groovy installation is on a windows. M...How can I configure groovy in hudson. My groovy installation is on a windows.
My install location is
C:\Program Files\Groovy\Groovy-1.6.4
I have a SystemVariable in windows called GROOVY_HOME set to C:\Program Files\Groovy\Groovy-1.6.4
I have added this to the path as %GROOVY_HOME%\bin
In Hudson manage I am trying to specify the
groovy installation name as 'Groovy1.6.4'
GROOVY_HOME as C:\Program Files\Groovy\Groovy-1.6.4
as soon as I type this I get
HTTP Status 404 -
type Status report
message
description The requested resource () is not available.
Apache Tomcat/5.5.27
Also select 'execute groovy script' does not show the text box where I can specify the groovy script.
What am I doing wrong.
Thanks for your help.