I am getting below error while mvn clean install / mvn compile

[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:16 min
[INFO] Finished at: 2022-04-12T18:02:59+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile (default-compile) on project kitsjiraclient: Compilation failure
[ERROR] /<path to java file in the project>.java:[11,52] cannot access org.springframework.beans.factory.annotation.Autowired
[ERROR]   bad class file: C:\Users\DELL\.m2\repository\org\springframework\spring-beans\6.0.0-M3\spring-beans-6.0.0-M3.jar(org/springframework/beans/factory/annotation/Autowired.class)
[ERROR]     class file has wrong version 61.0, should be 52.0
[ERROR]     Please remove or make sure it appears in the correct subdirectory of the classpath.

Comment From: dilnei

It is a compilation failure, there are some requirements to run spring boot 3 see it:

Spring Boot 3.0.0-SNAPSHOT requires Java 17. Spring Framework 6.0.0-M3 or above is also required.

I saw in your log that you have this error:

[ERROR] class file has wrong version 61.0, should be 52.0

Have you checked the java version?

Also, Maven needs to be a minimum 3.5x version

Please check the requirements: https://docs.spring.io/spring-boot/docs/3.0.0-SNAPSHOT/reference/htmlsingle/#getting-started.system-requirements

Comment From: pruidong

You can try to check your JDK version, or clean your local gradle cache repository and let it download again.

Comment From: pruidong

You can get the latest JDK here:

https://jdk.java.net/

Comment From: shyamsunderkaranam

My Java version is 8. When I run it through IDEs it works fine. But when I try to package , it gives the error. Attached POM. Which latest version of spring boot is compatible with 8 pom - Copy.zip

Comment From: pruidong

Spring Boot 2.x version supports Java 8 .

Comment From: pruidong

Spring Boot 3.x version requires minimum JDK 17, you should upgrade your JDK or use Spring Boot 2.X.

class file has wrong version 61.0, should be 52.0

The reason for this exception is:

Spring Framework uses JDK17 to compile, and you use JDK8 to compile here, resulting in inconsistent class file versions and throwing exceptions.

Comment From: wilkinsona

Thanks for getting in touch, but it feels like this is a question that would be better suited to Stack Overflow. As mentioned in the guidelines for contributing, we prefer to use GitHub issues only for bugs and enhancements. Feel free to update this issue with a link to the re-posted question (so that other people can find it) or add some more details if you feel this is a genuine bug.