[antlr-interest] Antlr3 in Eclipse and Maven?

Brad Cox bradjcox at gmail.com
Wed Jun 20 05:15:20 PDT 2012


Thanks! The new version number did the trick. The wiki instructions are
just broken.

And I still don't have a solution to why the grammar statement still isn't
recognized.

That revealed a problem I've seen all along in the generated lexer code...
the _type variable is never declared. Accepting the eclipse quick fix
(declare local variable) clears the problem. But the code generator should
have done this without having to repair it by hand.

Failed to execute goal
> org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile
> (default-compile) on project Xacml-Antlr: Compilation failure: Compilation
> failure:
> [ERROR]
> /Users/Brad/Dropbox/Xacml-Antlr/target/generated-sources/antlr3/my/XacmlLexer.java:[3239,29]
> cannot find symbol
> [ERROR] symbol  : variable _type
> [ERROR] location: class my.XacmlLexer
> [ERROR]
> /Users/Brad/Dropbox/Xacml-Antlr/target/generated-sources/antlr3/my/XacmlLexer.java:[3246,29]
> cannot find symbol
> [ERROR] symbol  : variable _type
> [ERROR] location: class my.XacmlLexer
> [ERROR]
> /Users/Brad/Dropbox/Xacml-Antlr/target/generated-sources/antlr3/my/XacmlLexer.java:[3314,21]
> cannot find symbol
> [ERROR] symbol  : variable _type
> [ERROR] location: class my.XacmlLexer
> [ERROR]
> /Users/Brad/Dropbox/Xacml-Antlr/target/generated-sources/antlr3/my/XacmlLexer.java:[3403,29]
> cannot find symbol
> [ERROR] symbol  : variable _type
> [ERROR] location: class my.XacmlLexer
> [ERROR]
> /Users/Brad/Dropbox/Xacml-Antlr/target/generated-sources/antlr3/my/XacmlLexer.java:[3412,28]
> cannot find symbol
> [ERROR] symbol  : variable _type
> [ERROR] location: class my.XacmlLexer
> [ERROR]
> /Users/Brad/Dropbox/Xacml-Antlr/target/generated-sources/antlr3/my/XacmlLexer.java:[3419,28]
> cannot find symbol
> [ERROR] symbol  : variable _type
> [ERROR] location: class my.XacmlLexer


On Wed, Jun 20, 2012 at 8:06 AM, Verny Quartara <webny23 at gmail.com> wrote:

> I post my working configuration, hoping that helps.
> My grammar compiles fine in both AntlrWorks and Maven.
> I putted my .g files in src/main/antlr3 and the gunit tests in
> src/test/gunit.
>
> Bye
>
> <plugin>
>                 <groupId>org.antlr</groupId>
>                 <artifactId>antlr3-maven-plugin</artifactId>
>                 <version>3.4</version>
>                 <executions>
>                     <execution>
>                         <goals>
>                             <goal>antlr</goal>
>                         </goals>
>                     </execution>
>                 </executions>
>             </plugin>
>             <plugin>
>                 <groupId>org.antlr</groupId>
>                 <artifactId>maven-gunit-plugin</artifactId>
>                 <version>3.4</version>
>                 <executions>
>                     <execution>
>                         <id>maven-gunit-plugin</id>
>                         <phase>generate-test-sources</phase>
>                         <goals>
>                             <goal>gunit</goal>
>                         </goals>
>                     </execution>
>                 </executions>
>             </plugin>
>
>
> 2012/6/20 Brad Cox <bradjcox at gmail.com>
>
>>  I've an antlr3 grammar that compiles fine in AntlrWorks. I'm trying to
>> load
>> it into Eclipse with Maven to start work on the non-grammar bits.
>>
>> Problem is it won't compile in either. Error flags are on the first line,
>> grammar ...;, and nothing I've tried will remove them. Somehow antlr2 is
>> getting involved in the compile step.
>>
>> The dependency list shows antlr-runtime-3.2.jar and stringtemplate-3.2.jar
>> now. Previously there was an antlr2 jar that I've explicitly excluded.
>> Didn't make a difference.
>>
>> My best guess is that the antlr3 maven plugin is launching antlr2, not
>> antlr3, but I have no visibility into what that plugin is doing.
>>
>> <groupId>org.antlr</groupId>
>> <artifactId>antlr3-maven-plugin</artifactId>
>> <version>3.1.3-1</version
>>
>> There's also likely confusion over which eclipse plugin I should be using.
>> After some searching I removed everything but the one from certiv, but no
>> joy.
>>
>> Could someone point me to a known-to-work reference? Thanks!
>>
>> List: http://www.antlr.org/mailman/listinfo/antlr-interest
>> Unsubscribe:
>> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>>
>
>
>
> --
> Verny Quartara
>
>


-- 
Cell: 703-594-1883
Blog: http://bradjcox.blogspot.com
Web: http://virtualschool.edu
Manassas VA 20111


More information about the antlr-interest mailing list