Even though there is an error in the antlr grammar file that is detected, the gradle build does not fail if the “-lib” argument is used.
Code demonstrating the problem is available at:
Use case this came from was having a grammar file A that imported another grammar file B. Built project successfully. Introduced syntax error in B, and project still built. However, removing all generated .java and .class files and the building project failed.