17.6 Hooking into Build Events - Reference Documentation
Authors: Graeme Rocher, Peter Ledbrook, Marc Palmer, Jeff Brown, Luke Daley, Burt Beckwith, Lari Hotari
Version: 2.4.4
17.6 Hooking into Build Events
Post-Install Configuration and Participating in Upgrades
Grails plugins can do post-install configuration. This is achieved using a specially named script under thescripts directory of the plugin - _Install.groovy._Install.groovy is executed after the plugin has been installed.This scripts is a Gant script, so you can use the full power of Gant. An addition to the standard Gant variables there is also a pluginBasedir variable which points at the plugin installation basedir.As an example this _Install.groovy script will create a new directory type under the grails-app directory and install a configuration template:ant.mkdir(dir: "${basedir}/grails-app/jobs")ant.copy(file: "${pluginBasedir}/src/samples/SamplePluginConfig.groovy", todir: "${basedir}/grails-app/conf")
pluginBasedir variable is not available in custom scripts, but you can use fooPluginDir, where foo is the name of your plugin.Scripting events
It is also possible to hook into command line scripting events. These are events triggered during execution of Grails target and plugin scripts.For example, you can hook into status update output (i.e. "Tests passed", "Server running") and the creation of files or artefacts.A plugin just has to provide an_Events.groovy script to listen to the required events. Refer the documentation on Hooking into Events for further information.

