记一次antlr错误:ANTLR Tool version 4.5.3 used for code generation does not match the current runtime version 4.7.2ANTLR

落爺英雄遲暮 提交于 2019-11-30 18:33:38

使用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即可

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!