Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix Unsupported class file major version 57 in maven for Java 13 and Spring

I have this error

How to fix it?

Caused by: java.lang.IllegalArgumentException: Unsupported class file major version 57

I have such POM

 <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.1.5.RELEASE</version>
</parent>

<properties>
    <java.version>13</java.version>
</properties>

Project has many literals, so Java 13 is required.

like image 924
Arthur Avatar asked Jul 31 '19 22:07

Arthur


2 Answers

Changing Spring boot version in the pom.xml solved this issue for me.

   <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.2.0.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
   </parent>
like image 192
Jayaprada Gopalakrishna Avatar answered Oct 10 '22 18:10

Jayaprada Gopalakrishna


The 2.2.0 version of spring-boot hasn't been released yet, but there is a milestone build (M4). If you want to use it, you need to add another maven repository to your pom.xml file:

<repositories>
    <repository> 
        <id>repository.spring.milestone</id> 
        <name>Spring Milestone Repository</name> 
        <url>http://repo.spring.io/milestone</url> 
    </repository>
</repositories>

You can then depend on the milestone build:

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.2.0.M4</version>
</parent>

See also: https://www.baeldung.com/spring-maven-repository

like image 22
Erwin Bolwidt Avatar answered Oct 10 '22 20:10

Erwin Bolwidt