最近在做spring boot项目的时候出现了一个很难弄的问题,找了老半天也没有个详细的解决的方法,后来才发现是包的冲突问题,特此记录,帮助和我遇到相同的问题的人。
出现的问题
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor.<clinit>(PaginationInnerInterceptor.java:70)
The following method did not exist:
net.sf.jsqlparser.schema.Column.withColumnName(Ljava/lang/String;)Lnet/sf/jsqlparser/schema/Column;
The method's class, net.sf.jsqlparser.schema.Column, is available from the following locations:
jar:file:/E:/apache-maven-3.8.1-bin/localMaven3.8.1/com/github/jsqlparser/jsqlparser/3.2/jsqlparser-3.2.jar!/net/sf/jsqlparser/schema/Column.class
The class hierarchy was loaded from the following locations:
net.sf.jsqlparser.schema.Column: file:/E:/apache-maven-3.8.1-bin/localMaven3.8.1/com/github/jsqlparser/jsqlparser/3.2/jsqlparser-3.2.jar
net.sf.jsqlparser.parser.ASTNodeAccessImpl: file:/E:/apache-maven-3.8.1-bin/localMaven3.8.1/com/github/jsqlparser/jsqlparser/3.2/jsqlparser-3.2.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of net.sf.jsqlparser.schema.Column
Process finished with exit code 1
运行项目出现这个报错;
解决方法
针对此包冲突的问题,我们需要借助mavenhelper 插件
下载插件:
安装上插件后点击pom.xml
之后点击左下角的Dependency Analyzer
选中 Conflicts==> 选中需要解决的冲突 ==》 鼠标右键,exclude; 如果不是根的话就,Jump left Tree 之后再 exclude。
操作完毕后记得进行Reimport,