Gosh is an "incubator" project that provides an alternate way to run command-line Groovy scripts, as well as a simplified way to write Windows Services (WinNT Services) in Groovy. Gosh treats scripts the same, whether they are run from the command-line or as a service. You can debug a service by running it from the command-line, and you can also run standard command-line Groovy scripts. There is very little difference between a Groovy script that is intended to be run as a Windows Service and any other Groovy script.
Because this is an incubation project, many of the details documented here are likely to change over time. As of this writing, the following items still need to be addressed (these will be documented in Jira eventually):
- Need an installer. Manual setup is still a little more complex than I would like.
- Needs to use a native runner for command-line. Currently uses a batch file.
- Setting up a new Windows Service requires a batch file. Should support either a GUI or Groovy script.
- Classloader structure works well, but still needs peer review.
- Dynamic-loading design (including folder structure conventions) need peer review.
- Dynamic loading of DLLs is still experimental at this point, and has not been proven in non-sun JVMs.
- Need to roll in basic logging support.
- Gosh uses an older version of JavaService.exe to run Windows Services. Needs to be updated and tested.
Building from Source
One of the key differences between Gosh and the Groovy command-line tools is the emphasis on local, dynamic (runtime) project configuration. The Gosh project model follows a convention similar to what you would see in an application server, like a Tomcat web application. The standard Groovy command-line tools use a global configuration file that applies to all scripts. Although these tools support dynamically changing the classpath, the support is not obvious and somewhat awkward. Conversely, in Gosh, there is no global configuration at all. JAR files (and also DLLs) are local to the project, and are loaded dynamically. Gosh also supports a local configuration script, written in Groovy, that lets you conditionally define external dependencies. This makes it easy to use different library versions in different projects on the same machine, something which Groovy isn't particularly good at at them moment. It also makes it almost foolproof to distribute an entire Groovy-based application to different machines.
A Gosh project
Configuring a WinNT Service