I am trying to create an antlr project with maven, the project structure is similar to
src/main + |-antlr4 |-fo/bar |-G1.g4 |-G2.g4 |-imports
in which G1 imports G2 as such:
grammar G1; import G2;
However, when compiling with maven, I got the following error:
[ERROR] Message{errorType=CANNOT_FIND_IMPORTED_GRAMMAR, args=[G2, fo\bar\G1.g4], e=null, fileName='null', line=-1, charPosition=-1}
This is not a problem if I put G1.g4 and G2.g4 directly in the antlr4 directory. It seems to me that when placing Grammer files in a package, does it need a special syntax to reference it in the import statement?
I notice this problem: Antlr4 maven plugin cannot find grammar files in different directories
but here the grammars are in the same directory .
source share