为什么我的 ANTLR 构建 Ant 任务失败并显示“无法确定生成的类”?
我正在尝试使用 ANTLR3 Ant 的任务,但我收到“无法确定生成的类”构建失败消息。
一项快速研究表明,许多人都遇到过同样的问题,但没有提供解决方案(请参阅下面的链接)。
有人可以建议一个不使用常规 Java Ant 任务的解决方案吗?
外部链接:
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 solution that doesn't resort to using a regular Java Ant task?
External links:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Ant 1.8.2(最新版本)中包含的
antlr
任务似乎依赖于 ANTLR 2.7.2(在$ANT_HOME/lib/ant-antlr.pom
中定义)并使用$ANT_HOME/lib/ant-antlr.jar
任务正在扫描目标文件以查找与
^class (.*) extends .*
匹配的行。 ,其中第一个匹配组将用作生成文件的名称。这整个语法似乎已在 ANTLR 3.x 中删除,或者至少是可选的,因为我可以在不使用它的情况下生成解析器。您提到的常规 java 任务解决方法在 http://antlr.org/ 的“文件”下 。共享”标题是一个指向 Ant 的 ANTLR v3 任务,但不幸的是它似乎不是那种下降-in 替换我希望的实际上,它似乎相当复杂,所以我坚持使用普通的 java 任务。
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.