The Gradle announce plugin enables you to publish messages on succeeded tasks to your favourite platforms. It supports
To use the announce plugin, include in your build script:
After that, configure you username and password (if required for the service you want to announce to) with:
Example 40.2. Configure the announce plugin
build.gradle
announce {
username = 'myId'
password = 'myPassword'
}Finally, you can use announce with any task by attaching it via task.dolast() as shown below
Example 40.3. Using the announce plugin
build.gradle
task helloWorld << {
ant.echo(message: "hello")
}
helloWorld.doLast {
announce("Build complete", "notify-send")
announce("Build complete", "twitter")
}As you can see, the syntax in .doLast is
announce("MESSAGE", "TARGET")
Where MESSAGE is any GString you pass (and might have constructed before). And TARGET might one of the following:
Table 40.1. announce plugin targets
| target literal | target | configuration parameters | more information |
| username , password | |||
| snarl | Snarl Windows Notification Service | ||
| growl | Growl Mac OS X Notification Service | ||
| notify-send | Notify Ubuntu Notification Service | You need to have notify-send installed for this. Run sudo apt-get install libnotify-bin
on Ubuntu to install it. |