Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error "class file has wrong version 55.0, should be 52.0" when building Alfresco

Tags:

java

I Generated a project from the Maven Alfresco archetypes:

mvn archetype:generate -Dfilter=org.alfresco:

when I try to build it fails:

[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

as you see the java and javac are 8. I have no idea how to solve this problem.

what is the problem?

like image 325
mhrsalehi Avatar asked Mar 10 '20 06:03

mhrsalehi


1 Answers

It complains that some class files were compiled using Java 11 (which is Java 55.0, List of Java class file format major version numbers?) and you try to compile the rest with Java 8.

You should update your local Java version to at least Java 11 and then try to re-compile again

like image 79
rieckpil Avatar answered Sep 29 '22 08:09

rieckpil