how to detect a build error from ant/maven via a bash script?

mvn clean test
if [[ "$?" -ne 0 ]] ; then
  echo 'could not perform tests'; exit $rc
fi
  • $? is a special shell variable that contains the exit code (whether it terminated successfully, or not) of the most immediate recently executed command.
  • -ne stands for “not equal”. So here we are testing if the exit code from mvn clean is not equal to zero.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)