Difference between revisions of "ANTLR maven plugin"

From BITPlan Wiki
Jump to navigation Jump to search
Line 12: Line 12:
  
 
= Example pom.xml configurations =
 
= Example pom.xml configurations =
 +
<source lang='xml'>
 +
<!-- 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>
 +
</source>
 
* https://github.com/antlr/grammars-v4/blob/master/antlr4/pom.xml
 
* https://github.com/antlr/grammars-v4/blob/master/antlr4/pom.xml

Revision as of 09:26, 22 October 2017

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>