Affects Version/s: None
Fix Version/s: 2.2
Number of attachments :
When ANTLR parsers (e.g. the text parser and the tree parser) share token vocabularies through the importVocab/exportVocab options, ANTLR plugin does not reorder grammars sent to the antlr. As the result, a compile will fail if the grammar names are not sorted manually. A work-around is to sort the grammars manually is usually an easy fix, but if this is something that could be automated it would be a preferred solution to the problem.
See http://www.antlr.org/doc/vocab.html for information on importVocab/exportVocab.
Steps to reproduce the bug:
1. Create a maven project
2. Unzip the attached file into the src/main directory. This will create antlr directory with two files, bug.g and bugtree.g, in it.
3. Add maven-antlr-plugin to the POM with <grammars>bugtree.g,bug.g</grammars>
4. Run mvn compile. Note that the compile fails because the import vocabulary referenced by bugtree.g does not exist.
5. Run mvn compile again. Note that this time the compile succeeds.
Ideally, the plugin should recognize that the import vocabulary required by the grammar mentioned earlier in the list is produced by the grammar mentioned later in the list, and re-order the grammars based on this knowledge. I understand that this would require a lot more "parsing" than is currently going on in the plugin, but doing so would eliminate some very subtle errors (my co-worker spent a lot of time trying to figure out a similar problem in our ant-based build scripts).