Desktop notifications for Gradle.
A notification is sent when a build ends indicating if the build has failed or succeeded.
Gradle < 4.2 : Use gradle-notifier v1.2.0
Gradle >= 4.2 : Use gradle-notifier v2.0.0+
The plugin can be configured in an initialization script or in the build script.
It is also deployed on https://plugins.gradle.org.
For example, create (or edit) $HOME/.gradle/init.gradle
file:
initscript {
repositories {
mavenCentral()
}
dependencies {
classpath group: 'fr.jcgay', name: 'gradle-notifier', version: '3.0.0'
}
}
rootProject {
apply plugin: fr.jcgay.gradle.notifier.GradleNotifierPlugin
}
In build.gradle
, add:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath group: 'fr.jcgay', name: 'gradle-notifier', version: '3.0.0'
}
}
apply plugin: 'fr.jcgay.gradle-notifier'
The plugin is based on send-notification. Available notifiers and customization are described at this wiki.
You can rely on a property file located at $HOME/.send-notification
to configure your environment or use gradle to pass properties to the plugin.
notifier {
implementation = 'notificationcenter'
continuousNotify = false
threshold {
time = 10
unit = java.util.concurrent.TimeUnit.SECONDS
}
timeout {
time = 1
unit = java.util.concurrent.TimeUnit.SECONDS
}
growl {
port = 23053
host = 'localhost'
password = 'azerty123'
}
snarl {
host = 'localhost'
port = 9887
appPassword = 's3cr3t'
}
pushbullet {
apikey = 'key123'
device = 'abcdef'
}
notifysend {
timeout = 7
path = 'notify-send'
}
notificationcenter {
path = 'terminal-notifier'
activate = 'com.apple.Terminal'
sound = 'default'
}
systemtray {
wait = 2
}
notifu {
path = 'notifu64'
}
kdialog {
path = 'kdialog'
}
anybar {
host = 'localhost'
port = 1738
}
toaster {
path = 'toast'
}
notify {
position = 'TOP_LEFT'
darkstyle = true
}
burnttoast {
sound = 'Reminder'
}
slack {
token = 'secret.token'
channel = '@jcgay'
}
}
notifier.threshold
allows to bypass notification when the build ends before the configured threshold.
notifier.continuousNotify
activate notifications for continuous build (using --continuous
or -t
).
notifier.timeout
configures the time Gradle will wait to communicate with a notifier.
All parameters are configured by default, if you're fine with it, no need to write them down.
gradle-notifier
will try to find an available notifier on your system.
Notifier configuration can also be set using system properties. One can use -Dnotifier.implementation=anybar
or -Dnotifier.anybar.port=9999
to override parameters for a specific build execution.
Notifier | Screenshot |
---|---|
Growl, for Windows and OS X. | |
Snarl, for Windows | |
terminal-notifier, OS X | |
notification center OS X (since Mavericks) | |
notify-send for Linux | |
SystemTray since Java 6 | |
Pushbullet | |
Kdialog for KDE | |
notifu for Windows | |
AnyBar for OS X and Linux | |
Toaster for Windows 8 | |
Notify since Java 6 | |
BurntToast for Windows 10 | |
Slack |
./gradlew markNextVersion -Prelease.version=2.0.0
./gradlew release && ./gradlew clean publish