[antlr-interest] antlr3-maven-plugin (v3.2): "error(7): cannot find or open file: null/MyGrammar.g"
michael.guyver at gmail.com
Sat Jan 9 15:11:04 PST 2010
There's a a bug in the Antlr4Mojo class where the grammar files are
stored in the src/main/antlr3 root (for example
src/main/antlr3/MyGrammar.g). Despite scanning and finding the grammar
file (and reporting its location nicely), it results in a 'null' value
being passed back from findSourceSubdir(File,String) such that the
following error occurs:
error(7): cannot find or open file: null/MyGrammar.g
and results in the following exception trace:
Caused by: org.apache.maven.plugin.MojoExecutionException: ANTLR
caught 2 build errors.
... 16 more
I had formerly been using the codehaus 1.0 release and been setting
the output directory to
target/generated-sources/antlr/my/full/package/path/ so that the
generated files arrived in the right place. Happily the new plugin
does this for you so simply moving the grammar to
solved the problem and meant I didn't have to specify the output
directory either \:D/
Hope this helps any other people perplexed by the issue and that it
might result in a fix (not that I'm dependent on it any longer;)?
More information about the antlr-interest