开发者

Why does my ANTLR build Ant task fail with "Unable to determine generated class"?

开发者 https://www.devze.com 2023-03-23 12:21 出处:网络
I\'m trying to use ANTLR3 task for Ant, but I get an \"Unable to determine generated class\" build failure message.

I'm trying to use ANTLR3 task for Ant, but I get an "Unable to determine generated class" build failure message.

A quick research shows that many people have had the same problem, with no solution provided (see links below).

Can someone suggest a 开发者_StackOverflowsolution that doesn't resort to using a regular Java Ant task?

External links:

  • http://www.antlr.org/pipermail/antlr-interest/2009-November/036795.html
  • http://www.antlr.org/pipermail/antlr-interest/2006-July/016870.html
  • http://palove.kadeco.sk/itblog/posts/40


The antlr task included with Ant 1.8.2 (the latest version) seems to be dependent on ANTLR 2.7.2 (defined in $ANT_HOME/lib/ant-antlr.pom and using $ANT_HOME/lib/ant-antlr.jar.

What the task is doing is scanning the target file for a line matching ^class (.*) extends .*, where the first match group will be used as the name of the generated file. This whole bit of syntax seems to have been dropped in ANTLR 3.x, or at least made optional, because I'm able to generate parsers without it using the regular java task work-around you mentioned.

On the front page of http://antlr.org/ under the "File Sharing" heading is a link to ANTLR v3 task for Ant, but unfortunately it doesn't appear to be the sort of drop-in replacement I was hoping for. Actually, it seems to be rather convoluted so I've stuck with using the plain java task.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号