Using ANTLR 3 with Maven 2

Skip to end of metadata
Go to start of metadata

Maven plugin for ANTLR 3

Please refer to the Official ANTLR3 Maven documentation

  1. Jul 09, 2009

    Here are some notes from Sean O'Dell and Jim Idle (with minor editing of URLs):

    from http://www.antlr.org/pipermail/antlr-interest/2009-June/035049.html

    1) Use the plugin described here, exactly as described:
    http://antlr.org/antlr3-maven-plugin/index.html
    2) Use version '3.1.3-1' or better. It's available in central, so you can
    just update your plugins and away you go.
    3) If you want to call the plugin directly, use 'mvn
    groupId:artifactId:antlr', not just 'antlr3:antlr' which will actually
    download and call a version by codehaus, which I tore my hair out with. I
    won't call it buggy, but it was an entirely unpleasant experience.
    4) It wasn't entirely clear to me where to put the grammars at first; they
    go into 'src/main/antlr3/your/package/hierarchy/here'. The generated files
    will be created in the same hierarchy. Unfortunately, just like Java, you
    also have to give your grammar a package name to use.
    5) I couldn't get m2eclipse to "see" the generated source directory; you
    might just have to add it to the list of source folders like I did.

    from http://www.antlr.org/pipermail/antlr-interest/2009-June/035053.html

    1) Ignore eclipse to start with;
    2) Read: http://www.antlr.org/antlr3-maven-plugin
    3) When you can type mvn install then integrate with eclipse
    4) To integrate with eclipse you find the docs on the maven eclipse
    plugin and follow the instructions to generate an eclipse project. I
    have never found it to be so great at doing this, but Eclipse fans have
    better mileage. I use netbeans as it understands Maven without having to
    get Maven to produce a project and so on, you just open the directory
    with the pom.xml as a project.