05 Feb 2015

Maven notifications under KDE

Written by ilgrosso

Apache Maven is probably the build tool for Java, and there are many ways to pimp it, as developers always love to do.

Some bells and whistles do not seem to work well under Linux - especially the desktop notification; in this blog post there is a nice solution for Ubuntu / Unity, but what if you're enjoying the peace of mind of KDE?

I've been experiencing a very simple trick based on the post above; just define in your ~/.bashrc

export M2_HOME=/opt/apache-maven-3.2.1
alias maven=$M2_HOME/bin/mvn
notified_maven() {
  maven $* | \
  perl -pe'$m|=/BUILD .*SUCCESS/; END {exit!$m}' && \

  /usr/bin/kdialog --title "Maven" --passivepopup "`basename $(pwd)`: mvn $*" "Build SUCCESS" 2 ||
  /usr/bin/kdialog --title "Maven Error" --error "`basename $(pwd)`: mvn $*" "Build FAILED"
alias mvn=notified_maven

An idea of the result is shown in the images below: enjoy!



« Return