Compilation batches

Is it possible to test in bash whether the compilation (build) was a success? If so, How?
$? does not seen to do the trick. Catching the output of the compilation does not seem to work (no std io)

$? should work when you’re in bash. 0 means success. How exactly have you tested it?

#!/bin/bash
…/testbeforecommit.sh
echo “$?”

end of output:
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn -rf :language-nl
0

Maybe it’s because the Maven return value isn’t transferred from …/testbeforecommit.sh to your bash script. Does it help if you put the echo “$?” directly to the end of testbeforecommit.sh?

It works now. I had to store the exit code before the (succesful) cd command, then exit the script ucing exit with the stored code. Thanks for the hint.

build.sh nl clean test
returns error level 1, even though it is successful. I that the warning level?

It’s the return code of the last command in build.sh and that’s not mvn but a rm command that tries to remove a file which doesn’t exist.