我从 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
如您所见,java
和 javac
是 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/