• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Simple configuration
2
3 If your grammar files are organized into the default locations as described in the {{{../index.html}introduction}},
4 then configuring the pom.xml file for your project is as simple as adding this to it
5
6+--
7<plugins>
8<plugin>
9    <groupId>org.antlr</groupId>
10    <artifactId>antlr3-maven-plugin</artifactId>
11    <version>3.1.3-1</version>
12    <executions>
13        <execution>
14            <goals>
15                <goal>antlr</goal>
16            </goals>
17        </execution>
18    </executions>
19</plugin>
20...
21</plugins>
22+--
23
24 When the mvn command is executed all grammar files under <<<src/main/antlr3>>>, except any
25 import grammars under <<<src/main/antlr3/imports>>> will be analyzed and converted to
26 java source code in the output directory <<<target/generated-sources/antlr3>>>.
27
28 Your input files under <<<antlr3>>> should be stored in sub directories that
29 reflect the package structure of your java parsers. If your grammar file parser.g contains:
30
31+---
32@header {
33package org.jimi.themuss;
34}
35+---
36
37 Then the .g file should be stored in: <<<src/main/antlr3/org/jimi/themuss/parser.g>>>. THis way
38 the generated .java files will correctly reflect the package structure in which they will
39 finally rest as classes.
40
41