ANTLR maven plugin

From BITPlan Wiki
Jump to navigation Jump to search

This article is motivated by ANTLR Issue 2061- reference to undefined rule - useability of import and maven setup for it.

As of 2017-10-22 ANTLR Maven plugin 4.7 is the latest version of the ANTLR Maven plugin.

The available versions of the ANTLR Maven plugin started with Version 4.0 in January 2013.

The documentation on www.antlr.org is at Version 4.5 at the time of writing this article.

maven build-helper

Example pom.xml configurations

<!-- automate antlr grammar handling -->
			<plugin>
				<groupId>org.antlr</groupId>
				<artifactId>antlr4-maven-plugin</artifactId>
				<version>4.7</version>
				<configuration>
					<!-- basically this is the default setting -->
					<sourceDirectory>src/main/antlr4</sourceDirectory>
					<libDirectory>target/generated-sources/antlr4</libDirectory>
				</configuration>
				<executions>
					<execution>
						<id>antlr</id>
						<goals>
							<goal>antlr4</goal>
						</goals>
					</execution>
				</executions>
			</plugin>