/gradle-notifier

Desktop notifications for Gradle

Primary LanguageGroovyMIT LicenseMIT

Gradle notifier

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

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: '0.4.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: '0.4.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
    }
    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'
    }
}

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).

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

#Build

##Status Build Status Coverage Status

##Set next version

./gradlew markNextVersion -Prelease.nextVersion=2.0.0

##Release

./gradlew release && ./gradlew clean publish