java - 构建 Alfresco 时出现错误 "class file has wrong version 55.0, should be 52.0"

标签 java

我从 Maven Alfresco 原型(prototype)生成了一个项目:

mvn archetype:generate -Dfilter=org.alfresco:

当我尝试构建时失败:

[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /D:/Mehrdad/alfresco/alfresco-platform/src/main/java/com/mehr/alfresco/platformsample/HelloWorldWebScript.java:[20,49] cannot access org.springframework.extensions.webscripts.Cache
  bad class file: C:\Users\mehrdad.s\.m2\repository\org\alfresco\surf\spring-webscripts\7.9\spring-webscripts-7.9.jar(org/springframework/extensions/webscripts/Cache.class)
    class file has wrong version 55.0, should be 52.0
    Please remove or make sure it appears in the correct subdirectory of the classpath.
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for AIO - SDK 4.0 1.0-SNAPSHOT:
[INFO]
[INFO] AIO - SDK 4.0 ...................................... SUCCESS [  1.063 s]
[INFO] Alfresco Platform/Repository JAR Module ............ FAILURE [01:54 min]
[INFO] Alfresco Share JAR Module .......................... SKIPPED
[INFO] Integration Tests Module ........................... SKIPPED
[INFO] Alfresco Platform/Repository Docker Module ......... SKIPPED
[INFO] Alfresco Share Docker Module ....................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  02:02 min
[INFO] Finished at: 2020-03-10T09:42:54+03:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project alfresco-platform: Compilation failure
[ERROR] /D:/Mehrdad/alfresco/alfresco-platform/src/main/java/com/mehr/alfresco/platformsample/HelloWorldWebScript.java:[20,49] cannot access org.springframework.extensions.webscripts.Cache
[ERROR]   bad class file: C:\Users\mehrdad.s\.m2\repository\org\alfresco\surf\spring-webscripts\7.9\spring-webscripts-7.9.jar(org/springframework/extensions/webscripts/Cache.class)
[ERROR]     class file has wrong version 55.0, should be 52.0
[ERROR]     Please remove or make sure it appears in the correct subdirectory of the classpath.

D:\Mehrdad\alfresco>java -version
java version "1.8.0_231"
Java(TM) SE Runtime Environment (build 1.8.0_231-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.231-b11, mixed mode)

D:\Mehrdad\alfresco>javac -version
javac 1.8.0_231

如您所见,javajavac 是 8。我不知道如何解决这个问题。

有什么问题吗?

最佳答案

它提示某些类文件是使用 Java 11(即 Java 55.0, List of Java class file format major version numbers? )编译的,而您尝试使用 Java 8 编译其余部分。

您应该将本地 Java 版本更新到至少 Java 11,然后尝试再次重新编译

关于java - 构建 Alfresco 时出现错误 "class file has wrong version 55.0, should be 52.0",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60612488/

相关文章:

java - 如何在java中的jenkins构建中找到死代码?

java.sql.SQLSyntaxErrorException : Unknown column 'column_name' in 'field list' - mappings in entity are the same in as database

java - 如何从以 latin1 编码的结果集中以 UTF-8 编码字符串

java - java中如何让一段代码在一段时间后运行

java - 删除[反向退格]按钮

java - 如何修复执行 EValidator 时发生的错误

java - 基于http构建的大型rpc服务器

java - 替换 Apache POI 中的表列值

java - apache wicket 中一个标记的多个类

java - 如何使用java在Windows Phone应用程序中发送推送通知?