Our project uses two plugins:
apply plugin: 'java' apply plugin: 'antlr'
Grammar parsers/lexers generated by ANTLR are then compiled with the main source code. Generally this works fine. However, if the compilation is set to be incremental, then quite often it fails with errors like these:
.../src/main/java/some/LexerUser.java:8: error: package some.antlr does not exist import some.antlr.SomeLexer;
Contents of package
some.antlr is supposed to be autogenerated by the previous task, which actually does nothing, because everything is UP-TO-DATE. But the compilation task apparently fails to add the generated sources or compiled classes to the compilation classpath, so they cannot be referred to by other code.
I cannot quite figure out when it fails, but:
gradle clean classesalways succeeds;
- non-incremental compilation always succeeds, including after the failure described above;
- incremental compilation often (but not always) fails with errors as above.