elasticsearch-analysis-ansj icon indicating copy to clipboard operation
elasticsearch-analysis-ansj copied to clipboard

8.11.3版本mvn构建出错(类文件具有错误的版本 55.0, 应为 52.0)

Open tangwang opened this issue 1 year ago • 2 comments

环境: branch: v8.11.3 ES版本:8.11.3 java版本:1.8.0_362

mvn构建出错: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project elasticsearch-analysis-ansj: Compilation failure [ERROR] /ssd/samba_root1/projects/ansj/elasticsearch-analysis-ansj/src/main/java/org/ansj/elasticsearch/plugin/AnalysisAnsjPlugin.java:[14,34] 无法访问org.apache.lucene.analysis.Analyzer [ERROR] 错误的类文件: /root/.m2/repository/org/apache/lucene/lucene-core/9.8.0/lucene-core-9.8.0.jar(org/apache/lucene/analysis/Analyzer.class) [ERROR] 类文件具有错误的版本 55.0, 应为 52.0 [ERROR] 请删除该文件或确保该文件位于正确的类路径子目录中。 [ERROR] [ERROR] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

7.x版本都没问题,8.x就会出这个错误

尝试以下方法都不行:

  1. 把jdk版本从1.8改成 11, 17, 18、升级maven版本到3.9.6(同时修改pom.xml) 然后重新构建
  2. mvn dependency:purge-local-repository
  3. 删除xxx/.m2/repository/org/apache/lucene/lucene-core后再重新构建

希望有大佬能指教。能编译任何一个8.x版本就行

tangwang avatar Apr 10 '24 08:04 tangwang

有人说是依赖冲突,排查起来会比较麻烦(我不是做java的)。我可以准备一个什么样的环境,使得不依赖冲突?

tangwang avatar Apr 11 '24 01:04 tangwang

本地jdk版本可以用17,并且配置好环境变量

shi-yuan avatar Jul 16 '24 15:07 shi-yuan