On 09/29/2009 12:35 PM, Luca Li Greci wrote:
>
> <plugin>
> <groupId>org.antlr</groupId>
> <artifactId>antlr3-maven-plugin</artifactId>
> <version>3.1.3-1</version>
> <executions>
> <execution>
> <id>parser</id>
> <phase>generate-sources</phase>
> <goals>
> <goal>antlr</goal>
> </goals>
> <configuration>
> <sourceDirectory>src/main/resources/antlr3</sourceDirectory>
> <libDirectory>src/main/resources/antlr3*/org/mycompany/myproduct*</libDirectory>
> <outputDirectory>target/generated-sources/antlr3</outputDirectory>
> <includes>
> <include>***/myGrammar*.g*</include>
> </includes>
> </configuration>
> </execution>
> </executions>
> </plugin>
>
> As you can see under src/main/resources/antlr3 I created a "package
> structure" of subfolder and inside myproduct I put all my grammars.
>
> In this way I keep in synch what is generated as subdirectories with
> what I declared inside the grammar file, for instance
>
> @parser::header {package org.mycompany.myproduct;}
>
> If you don't do that you have a weird situation where the code is
> generate in the default package (top level), and in the code there's
> the package definition.... it doesn't compile.
Hi - you should avoid setting up your own structure under source and use
the pre-known locations of the .g files. Read the docs at
www.antlr.org/antlr3-maven-plugin. The .g files should go under the
antlr directory and they should be in sub directories of this directory
that reflect the package structure you want for the generated files.
Include and lib, as well as import is then calculated automatically.
Also note that we are at ANTLR 3.2 and plugin 3.2 now, though I think
that Maven central is not syncing our repository right now and I have no
time to try and work out why.
Jim
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address