When writing plugins using the Atlassian SDK, sometimes the builds take a little while and you go off doing other things. Maybe you'll get diverted and lose a few minutes.
It would be nice to have some kind of feedback/notification to let you know when the build is a success, fails or just when Tomcat is finally up and running.
On OS X, Growl is my first choice for notifications, so this post shows you how to hook together the Atlassian SDK (well, maven really) with Growl
You will need:
- Atlassian SDK of course
- Growl -- a notification system
- growlnotify -- a command-line tool to post Growl notifications
- Some pretty icon images
Install all of the above.
The Atlassian SDK acts as a wrapper for maven functionality. It uses a copy of maven 2.1.0 located at:
This path appears to be hard coded into a lot of the atlas- prefixed commands, so we have to get a bit hacky and move the original mvn file elsewhere and swap in a new mvn wrapper command.
mv mvn mvn.DIST
The new mvn file should look something like this:
# See: http://blank.jasonwhaley.com/2009/02/growl-maven-integration.html
mvn.DIST $* | awk '
if($0 ~ ".*BUILD ERROR.*") system( "echo "Build failed : (" | growlnotify "Maven" --name maven --image /Users/david/Pictures/mvn-growl/fail.png > /dev/null 2>&1" )
if($0 ~ ".*BUILD SUCCESSFUL.*") system( "echo "Build completed successfully : D" | growlnotify "Maven" --name maven --image /Users/david/Pictures/mvn-growl/success.png > /dev/null 2>&1" )
if($0 ~ ".*CTRL-C.*") system( "echo "localhost is now available : D" | growlnotify "Maven" --name maven --image /Users/david/Pictures/mvn-growl/atlassian-charlie.png > /dev/null 2>&1" )
Note that we've got some hard coded image paths here. Store them wherever suits best and update the mvn script.
Add execute permissions
chmod +x mvn
That's about it really.
Next time you successfully build from maven, you should get this:
A build failure should give this:
When you type atlas-run and Tomcat is ready, you should get this:
I know, this is not exactly a life changer, but it is a really handy way to get some feedback on build progress -- particularly for when localhost is ready.
If you have a more elegant solution, let me know.
Here are the icons used:
- RubiksIcons by memoryboy (I just converted them to PNG)
- The Charlie figure was mangled from the Atlassian website
- Growling polar bear (while featured on the home page) by lincolnblues