Skip to content
master
Switch branches/tags
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Gradle notifier

Desktop notifications for Gradle.
A notification is sent when a build ends indicating if the build has failed or succeeded.

Compatibility

Gradle < 4.2 : Use gradle-notifier v1.2.0
Gradle >= 4.2 : Use gradle-notifier v2.0.0+

Installation

The plugin can be configured in an initialization script or in the build script.

It is also deployed on https://plugins.gradle.org.

Initialization script

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
}

Build script

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'

Configuration

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.

Notifiers

Notifier Screenshot
Growl, for Windows and OS X. Growl
Snarl, for Windows Snarl
terminal-notifier, OS X terminal-notifier
notification center OS X (since Mavericks) notification-center
notify-send for Linux notify-send
SystemTray since Java 6 System Tray
Pushbullet pushbullet
Kdialog for KDE Kdialog
notifu for Windows notifu
AnyBar for OS X and Linux anybar
Toaster for Windows 8 Toaster
Notify since Java 6 Notify
BurntToast for Windows 10 BurntToast
Slack Slack

Build

Status

Build Status Coverage Status

Set next version

./gradlew markNextVersion -Prelease.version=2.0.0

Release

./gradlew release && ./gradlew clean publish