记一次antlr错误:ANTLR Tool version 4.5.3 used for code generation does not match the current runtime vers
Posted niutao
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了记一次antlr错误:ANTLR Tool version 4.5.3 used for code generation does not match the current runtime vers相关的知识,希望对你有一定的参考价值。
使用idea运行重构好的spark sql,在编译期出现如下错误:
ANTLR Tool version 4.5.3 used for code generation does not match the current runtime version 4.7.2ANTLR
原因:
<dependency> <groupId>org.antlr</groupId> <artifactId>antlr4-runtime</artifactId> </dependency>
点击进入依赖,看当前antlr4的底层的依赖:
<plugin> <groupId>org.antlr</groupId> <artifactId>antlr4-maven-plugin</artifactId> <version>4.5.3</version> <!-- use older version to process XPathLexer.g4, avoiding cyclic build dependency --> <executions> <execution> <id>antlr</id> <configuration> <sourceDirectory>src</sourceDirectory> </configuration> <goals> <goal>antlr4</goal> </goals> </execution> </executions> </plugin>
这样就能对上错误问题了,因为使用4.7.2生成的代码。但是在编译期间是4.5.3;所以出错了
解决:
将4.5.3改成4.7即可
以上是关于记一次antlr错误:ANTLR Tool version 4.5.3 used for code generation does not match the current runtime vers的主要内容,如果未能解决你的问题,请参考以下文章
java.lang.NoSuchMethodError: antlr.collections.AST.getLine()I错误解决