[antlr-interest] using the antlr maven repository

Jim Idle jimi at temporal-wave.com
Tue Mar 31 16:45:12 PDT 2009


Pete Siemsen wrote:
> Jim,
>
> Thanks, that helped.  Now I get
>
>
> /Users/siemsen/TranslateCIM/src/main/java/com/kyben/translatecim/TranslateCIM.java:[9,29] 
> cannot find symbol
> symbol  : class TranslateCIMLexer
> location: package com.kyben.translatecim
>
>
> I see that the new plugin is supposed to write 
> to target/generated-sources/antlr3.  My target/generated-sources/ has 
> an "antlr" subdirectory but no "antlr3" subdirectory.  I couldn't find 
> a TranslateCIMLexer.class anywhere in my directory tree.  Here's my 
> pom.xml file:
>
You need to organize your grammars under the src/main/antlr3 directory 
to reflect the package structure that the generated files should live 
in. So, if your lexer has:

@header
{
package x.y.z;
}

Then your source file is:

src/main/antlr3/x/y/z/mylexer.g


and so on. See the docs at: www.antlr.org/antlr3-maven-plugin (if you 
have not yet done so).

also, your pom has all the defaults in it. You wnat to use the example 
"Simple configurations" version, so:

			<plugin>
			    <groupId>org.antlr</groupId>
			    <artifactId>antlr3-maven-plugin</artifactId>
			    <version>3.1.3</version>
			    <executions>
			        <execution>
			            <configuration>
			                <goals>
			                    <goal>antlr</goal>
			                </goals>
			                <conversionTimeout>10000</conversionTimeout>
			                <debug>false</debug>
			                <dfa>false</dfa>
			                <nfa>false</nfa>
			                <excludes><exclude/></excludes>
			                <includes><include/></includes>
			                <libDirectory>src/main/antlr3/imports</libDirectory>
			                <messageFormat>antlr</messageFormat>
			                <outputDirectory>target/generated-sources/antlr3</outputDirectory>
			                <printGrammar>false</printGrammar>
			                <profile>false</profile>
			                <report>false</report>
			                <sourceDirectory>src/main/antlr3</sourceDirectory>
			                <trace>false</trace>
			                <verbose>true</verbose>
			            </configuration>
			        </execution>
			    </executions>


Just becomes:

			<plugin>
			    <groupId>org.antlr</groupId>
			    <artifactId>antlr3-maven-plugin</artifactId>
			    <version>3.1.3</version>
			    <executions>
			        <execution>
			            <configuration>
			                <goals>
			                    <goal>antlr</goal>
			                </goals>
			            </configuration>
			        </execution>
			    </executions>
			</plugin>

			</plugin>


Jim



More information about the antlr-interest mailing list