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

01-19 03:23