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:

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:

/path/to/atlassian-plugin-sdk-3.x/apache-maven/bin/mvn

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.


cd /path/to/atlassian-plugin-sdk-3.x/apache-maven/bin/
mv mvn mvn.DIST

The new mvn file should look something like this:


#!/bin/bash

# See: http://blank.jasonwhaley.com/2009/02/growl-maven-integration.html

mvn.DIST $* | awk '
{
print;
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" )
}
END {
}'

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.

---

Note:

Here are the icons used: