skip to Main Content

I am trying to build locally this repository https://github.com/spring-projects/spring-petclinic
I followed the steps from the repo but the build result looks like this:

[INFO] BUILD FAILURE

[INFO] ------------------------------------------------------------------------

[INFO] Total time: 6.757 s

[INFO] Finished at: 2023-01-23T15:27:08+02:00

[INFO] ------------------------------------------------------------------------

[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:3.0.1:build-info (default) on project spring-petclinic: Execution default of goal org.springframework.boot:spring-boot-maven-plugin:3.0.1:build-info failed: Unable to load the mojo 'build-info' in the plugin 'org.springframework.boot:spring-boot-maven-plugin:3.0.1' due to an API incompatibility: org.codehaus.plexus.component.repository.exception.ComponentLookupException: org/springframework/boot/maven/BuildInfoMojo has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0.

My Java version is:

$ java -version

openjdk version "11.0.17" 2022-10-18

OpenJDK Runtime Environment (build 11.0.17+8-post-Ubuntu-1ubuntu218.04)

OpenJDK 64-Bit Server VM (build 11.0.17+8-post-Ubuntu-1ubuntu218.04, mixed mode)

And Maven version is:

$ mvn -v

Apache Maven 3.6.0

Maven home: /usr/share/maven

Java version: 11.0.17, vendor: Ubuntu, runtime: /usr/lib/jvm/java-11-openjdk-amd64

Default locale: en, platform encoding: UTF-8

OS name: "linux", version: "5.10.102.1-microsoft-standard-wsl2", arch: "amd64", family: "unix"

I tried to run the steps from the repo, but that didn’t worked for me.

2

Answers


  1. class file version 61.0 = Java 17. If you are trying to run the project via your IDE, it will be using an independant java version from what’s configured for your terminal’s classpath.
    The tutorial mentiones Intellij, so I’ll assume that’s what you’re using. Go into File -> Project Structure and you will have your SDK and Language Level in there for that project, make sure they’re the correct versions.

    Login or Signup to reply.
  2. Try Java 14 or above to handle this:

    Java SE 14 (or JDK 14) is the version that handles class files with a version number of 61.0

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search