tags:

views:

1513

answers:

3

I'm trying to call an Antlr task in my Ant build.xml as follows:

<path id="classpath.build">
  <fileset dir="${dir.lib.build}" includes="**/*.jar" />
</path>

...

<target name="generate-lexer" depends="init">
  <antlr target="${file.antlr.lexer}">
    <classpath refid="classpath.build"/>
  </antlr>
</target>

But Ant can't find the task definition. I've put all of the following in that dir.lib.build:

  • antlr-3.1.jar
  • antlr-2.7.7.jar
  • antlr-runtime-3.1.jar
  • stringtemplate-3.2.jar

But none of those seems to have the task definition. (I've also tried putting those jars in my Ant classpath; same problem.)

+3  A: 

The current Antlr-task jar is available at http://www.antlr.org/share/1169924912745/antlr3-task.zip

It can be found on the antlr.org website under the "File Sharing" heading.

James A. Rosen
+1  A: 

You should use the antlrall.jar jar. You can go ahead and just drop it into your ant installation but that does mean that it will only work for that one install. We check the jar in and use taskdef to load the jar file so that it doesn't become another step for developers when they start on the team or move to a new computer.

stimms
A: 

@stimms: I can't find an Antlr-all jar. The downloads page says this:

Latest ANTLR version is 3.1, released August 12, 2008. v3 is written in ANTLR v2 and StringTemplate so you need those jars as well. The source distribution includes all jars (including v3's jar) necessary to run ANTLR from the command line. Use lib/antlr-3.1.jar to get everything.

And links tohttp://www.antlr.org/download/antlr-3.1.jar with link text "http://www.antlr.org/download/antlr-3.1.jar"

But that's the antlr-3.1.jar I had in my classpath before asking the Antlr mailing list for the separate task jar.

People keep mentioning an "antlr-all" jar, but it remains elusive and aloof.

James A. Rosen