Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spring-boot-maven-plugin:3.1.5 is not compatible with JDK 22 #37974

Closed
ZheSun88 opened this issue Oct 20, 2023 · 5 comments
Closed

spring-boot-maven-plugin:3.1.5 is not compatible with JDK 22 #37974

ZheSun88 opened this issue Oct 20, 2023 · 5 comments
Labels
for: external-project For an external project and not something we can fix status: invalid An issue that we don't feel is valid

Comments

@ZheSun88
Copy link

ZheSun88 commented Oct 20, 2023

Hi,

I am testing a spring project with the latest JDK versions.
when running our spring app with JDK 22-ea, the build failed with the following error

[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:3.1.5:repackage (repackage) on project latest-java: Execution repackage of goal org.springframework.boot:spring-boot-maven-plugin:3.1.5:repackage failed: Unsupported class file major version 66 -> [Help 1]

image

maven version: 3.9.5
java version: 22-ea

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Oct 20, 2023
@wilkinsona
Copy link
Member

We don't yet support Java 22 so problems like this are to be expected at the moment. In this case, if you re-run with -e as Maven recommends in its error message, you'll see that the error is coming from Spring Framework:

Caused by: java.lang.IllegalArgumentException: Unsupported class file major version 66
    at org.springframework.asm.ClassReader.<init> (ClassReader.java:199)
    at org.springframework.asm.ClassReader.<init> (ClassReader.java:180)
    at org.springframework.asm.ClassReader.<init> (ClassReader.java:166)
    at org.springframework.asm.ClassReader.<init> (ClassReader.java:287)
    at org.springframework.boot.loader.tools.MainClassFinder.createClassDescriptor (MainClassFinder.java:254)
    at org.springframework.boot.loader.tools.MainClassFinder.doWithMainClasses (MainClassFinder.java:216)
    at org.springframework.boot.loader.tools.MainClassFinder.findSingleMainClass (MainClassFinder.java:197)
    at org.springframework.boot.loader.tools.Packager.findMainMethod (Packager.java:336)
    at org.springframework.boot.loader.tools.Packager.findMainMethodWithTimeoutWarning (Packager.java:325)
    at org.springframework.boot.loader.tools.Packager.getMainClass (Packager.java:320)
    at org.springframework.boot.loader.tools.Packager.addMainAndStartAttributes (Packager.java:300)
    at org.springframework.boot.loader.tools.Packager.buildManifest (Packager.java:285)
    at org.springframework.boot.loader.tools.Packager.write (Packager.java:201)
    at org.springframework.boot.loader.tools.Packager.write (Packager.java:194)
    at org.springframework.boot.loader.tools.Repackager.repackage (Repackager.java:132)
    at org.springframework.boot.loader.tools.Repackager.repackage (Repackager.java:119)
    at org.springframework.boot.maven.RepackageMojo.repackage (RepackageMojo.java:214)
    at org.springframework.boot.maven.RepackageMojo.execute (RepackageMojo.java:204)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:103)
    at java.lang.reflect.Method.invoke (Method.java:580)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:103)
    at java.lang.reflect.Method.invoke (Method.java:580)
    at org.apache.maven.wrapper.BootstrapMainStarter.start (BootstrapMainStarter.java:52)
    at org.apache.maven.wrapper.WrapperExecutor.execute (WrapperExecutor.java:161)
    at org.apache.maven.wrapper.MavenWrapperMain.main (MavenWrapperMain.java:73)

spring-projects/spring-framework#31459 is tracking Framework's Java 22 support.

@wilkinsona wilkinsona closed this as not planned Won't fix, can't repro, duplicate, stale Oct 20, 2023
@wilkinsona wilkinsona added status: invalid An issue that we don't feel is valid for: external-project For an external project and not something we can fix and removed status: waiting-for-triage An issue we've not yet triaged labels Oct 20, 2023
@wilkinsona
Copy link
Member

Please note that support for Java 22 and later will require Spring Framework 6.1 and, therefore, Spring Boot 3.2.

@krzyk
Copy link
Contributor

krzyk commented Mar 12, 2024

@wilkinsona Sorry for resurrecting old issue, but spring boot 3.2.3 still has issues with JDK 22 - looks like the ASM should be upgraded in spring-boot-maven-plugin.

@wilkinsona
Copy link
Member

@krzyk that shouldn't be the case as Spring Framework's embedded version of ASM (which is what Boot's Maven plugin uses) has supported Java 22 since the 6.1.0 milestones. Please open a new issue with a minimal sample that reproduces the problem and we can take a deeper look.

@krzyk
Copy link
Contributor

krzyk commented Mar 13, 2024

Issue is not with spring per se, but with spring-boot-maven-plugin, I'll create issue, as it is easy to reproduce (just generate project from https://start.spring.io/ change java version to 22 and it fails)

Created #39927

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: external-project For an external project and not something we can fix status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

4 participants