Thursday, April 16, 2009

Post Build Notification Using Growl

Although I have Maven integration in my IDE, I often find myself running my build from the terminal. Typically this means kicking off the build, switching to some other application for a few minutes, and frequently checking my terminal for the desired "BUILD SUCCESSFUL" message. The repeated checking is an annoying waste of time that I've recently figured out how to eliminate.

The Growl application for Mac OS X is a simple and unobtrusive notification tool that integrates well with a number of other applications (Entourage, Adium, iTunes, etc). Install Growl by running the Growl.mpkg package on the disk image. A Growl companion tool, growlnotify, is included in the Growl disk image in the Extras folder and allows you to send notifications from the command line to Growl. Install growlnotify by running the install.sh script. The script will install growlnotify in your /usr/local/bin directory. Verify that this is on your path by opening a Terminal and typing



growlnotify -version


you should see output like


growlnotify 1.1.4
Copyright (c) The Growl Project, 2004-2008




Edit your ~/.profile file and include the following line to define a function named "growl" that you can call from you command line.


growl() { growlnotify -m "${1}"; return; }



Restart your Terminal application and try


growl "hello world"



You should see the text in a Growl notification on you desktop.

Now you can post-pend a Growl notification to any command you run from the command line. Try running a lengthy build like


mvn clean install; growl "build done"



While the build is running, be productive doing something else... You will be notified by Growl immediately after your build has finished!

Spice your notifications by downloading some cool icons and modifying your function with

growl() { growlnotify -I /Icons/Blinky.icns -m "${1}"; return; }