Debian Codegraph @

antlr4-maven-plugin/src/site/apt/examples/simple.apt.vm

raw
1 Simple 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>antlr4-maven-plugin</artifactId>
11 <version>${project.version}</version>
12 <executions>
13 <execution>
14 <goals>
15 <goal>antlr4</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/antlr4>>>, except any
25 import grammars under <<<src/main/antlr4/imports>>> will be analyzed and converted to
26 Java source code in the output directory <<<target/generated-sources/antlr4>>>.
27
28 Your input files under <<<antlr4>>> should be stored in sub directories that
29 reflect the package structure of your java parsers. If your grammar file <<<parser.g4>>> contains:
30
31 +---
32 @header {
33 package org.jimi.themuss;
34 }
35 +---
36
37 Then the <<<.g4>>> file should be stored in: <<<src/main/antlr4/org/jimi/themuss/parser.g4>>>. This way
38 the generated <<<.java>>> files will correctly reflect the package structure in which they will
39 finally rest as classes.
40