Created
July 14, 2016 19:17
-
-
Save dnault/3996a29ae1281df903d9ae116ad2cbeb to your computer and use it in GitHub Desktop.
Wrapper script for Maven that sends a notification to the Mac OS X notification center when execution completes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# USAGE: gmvn <parameters and goals> | |
# | |
# Invoke maven with the supplied parameters and goals. | |
# | |
# When the build is complete, send a message to the notification center indicating if the build was successful, and | |
# the directory in which it was run (in case there are multiple builds running concurrently). | |
# | |
function notify { | |
local TITLE=$1 | |
local MESSAGE=$2 | |
osascript -e "display notification \"$MESSAGE\" with title \"$TITLE\"" | |
} | |
PROJECT=${PWD##*/} | |
mvn $* | |
EXIT_STATUS=$? | |
if [ $EXIT_STATUS -eq 0 ]; then | |
notify "Success" $PROJECT | |
else | |
notify "FAILED" $PROJECT | |
fi | |
exit $EXIT_STATUS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Inspired by https://github.com/geoffreywiseman/maven-growl/blob/master/gmvn