Currently there is absolutely no way to define grammars which import token vocabs from different java packages when using the Maven Antlr Plugin. For Antlr v2, the only way to achieve this is by setting the working directory to the directory of the package containing the token vocab (the 'dir' attribute on the Ant task).
And ideally the plugin should really just track this anyway since it could easily know this.
This relates to MANTLR-1 and MANTLR-3.
I am working on a patch because I need this immediately.
What all this patch addresses:
1) Correct identification of dependent grammars based on importVocab (within the same build), extends-clause (within the same build) and user-supplied <glib/> options.
2) Improved "up to date" checking which additionally checks to see if either the importVocab grammar or super grammar have changed.
3) Correct ordering of grammar generation based on determined dependencies (#1)
4) (this JIRA issue) Allow generation of grammars which define importVocabs from grammars in other java packages.
NOTE : For #4, the Antlr v2 Tool achieves this by using PWD. Thus the fix here was to spawn a new process with the importVocab's output directory as the PWD. For simplicity sake I ended up defining a new dependency on org.apache.commons:commons-exec to help with Process handling. To date, there have been no releases of commons-exec; but I discussed this on IRC with Brett Porter who is one of the developers of commons-exec - he stated that a 1.0 release is on its way. Another option would be to look at directly using the exec plugin to help with here; Brett mentioned though that we'd probably be better off copying the exec code over rather than trying to use the plugin directly. On a side note, once commons-exec goes GA Brett said he planned on changing the exec plugin to use it.