This app demonstrates the new “Build Listening” feature of Grails 1.2.
Implementations of GrailsBuildListener can be injected into the build in 3 different ways
A very trivial implementation is included in this project as LoggingGrailsBuildListener
. This implementation simply logs all events to buildEvents.log
in the project directory.
To try it out, run…
./grailsw -Dgrails.build.listeners=LoggingGrailsBuildListener test-app
The property value is a comma separated list of class names (that implement GrailsBuildListener
).
Listeners can be set in grails-app/conf/BuildConfig.groovy
. Check out that file in this project.
To try it out, run…
./grailsw compile
To make sure that LoggingGrailsBuildListener
is available, then uncomment out…
//grails.build.listeners='LoggingGrailsBuildListener'
in BuildConfig.groovy
, then run any grails command.
Listeners can be registered during the build. See scripts/TestAppWithListener.groovy
in this project for an example of how to do so.
To try it out, run…
./grailsw compile
To make sure that LoggingGrailsBuildListener
is available, then run…
./grailsw test-app-with-listener
Grails 1.2 adds a “test event publishing” contract to ensure that all test types publish suitable events to inform interested parties on what is happening. The most obvious usage of this would be for an IDE to provide rich visual feedback of test execution.
Test types call an instance of GrailsTestEventPublisher to publish events during test execution into the Grails build system.
An IDE could inject a listener via the grails.build.listeners
system property, that communicates back with the IDE somehow. It could respond appropriately to the test event published by GrailsTestEventPublisher
.