quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.64k stars 2.64k forks source link

Quarkus update not working from 3.8.4 to 3.11 with target version JDK 21 #40988

Closed Paul6552 closed 1 month ago

Paul6552 commented 4 months ago

Describe the bug

I am using quarkus version 3.8.4 with JDK 21 (exactly temurin 21) for a longer time.

I wanted to upgrade to 3.11.0 because of websockets-next and run the maven command for quarkus update. ./mvnw io.quarkus.platform:quarkus-maven-plugin:3.11.0:update -N

I get the following error message: Fatal error compiling: error: invalid target release: 21

The whole stacktrace:

paul@Paulus:~/IdeaProjects/turniersoftware/pea-backend$ mvn io.quarkus.platform:quarkus-maven-plugin:3.11.0:update -N
[INFO] Scanning for projects...
[INFO] 
[INFO] -------------------< at.tanzauswertung:pea-backend >--------------------
[INFO] Building pea-backend 2.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- quarkus-maven-plugin:3.11.0:update (default-cli) @ pea-backend ---
[WARNING] quarkus:update goal is experimental, its options and output might change in future versions
[INFO] Detected project Java version: 21
[INFO] Detected project Java version: 21
[INFO] Instructions to update this project from '3.8.4' to '3.11.0':
[INFO] Extensions from io.quarkus.platform:quarkus-bom:
[INFO] 
[INFO] Resolved io.quarkus:quarkus-updates-recipes:1.0.17 with 3 recipe(s) to update from 3.8.4 to 3.11.0 (initially made for OpenRewrite MAVEN plugin version: 5.29.0) 
[INFO] OpenRewrite recipe generated: /tmp/quarkus-project-recipe-3852002865325284577.yaml
[INFO] 
[INFO] 
[INFO] 
[INFO]  ------------------------------------------------------------------------
[INFO] Executing:
/usr/bin/mvn -B -e org.openrewrite.maven:rewrite-maven-plugin:5.29.0:run -DplainTextMasks=**/*.txt,**/src/main/codestarts/**/*.java,**/*.md,**/*.kt,**/src/test/resources/__snapshots__/**/*.java,**/*.adoc,**/META-INF/services/** -Drewrite.configLocation=/tmp/quarkus-project-recipe-3852002865325284577.yaml -Drewrite.recipeArtifactCoordinates=io.quarkus:quarkus-update-recipes:1.0.17 -DactiveRecipes=io.quarkus.openrewrite.Quarkus -Drewrite.pomCacheEnabled=false
[INFO] 
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] 
[INFO] -------------------< at.tanzauswertung:pea-backend >--------------------
[INFO] Building pea-backend 2.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] >>> rewrite-maven-plugin:5.29.0:run (default-cli) > process-test-classes @ pea-backend >>>
[INFO] 
[INFO] --- maven-resources-plugin:3.3.1:copy-resources (copy-resources) @ pea-backend ---
[INFO] Copying 15 resources from ../pea-frontend/build to target/classes/META-INF/resources/pea
[INFO] 
[INFO] --- maven-resources-plugin:3.3.1:resources (default-resources) @ pea-backend ---
[INFO] Copying 8 resources from src/main/resources to target/classes
[INFO] 
[INFO] --- maven-compiler-plugin:3.12.1:compile (default-compile) @ pea-backend ---
[INFO] Nothing to compile - all classes are up to date.
[INFO] 
[INFO] --- maven-resources-plugin:3.3.1:testResources (default-testResources) @ pea-backend ---
[INFO] Copying 5 resources from src/test/resources to target/test-classes
[INFO] 
[INFO] --- maven-compiler-plugin:3.12.1:testCompile (default-testCompile) @ pea-backend ---
[INFO] Recompiling the module because of changed source code.
[INFO] Compiling 18 source files with javac [debug target 21] to target/test-classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.573 s
[INFO] Finished at: 2024-06-05T14:45:36+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.12.1:testCompile (default-testCompile) on project pea-backend: Fatal error compiling: error: invalid target release: 21 -> [Help 1]
[ERROR] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.12.1:testCompile (default-testCompile) on project pea-backend: Fatal error compiling
[ERROR]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
[ERROR]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
[ERROR]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
[ERROR]     at org.apache.maven.lifecycle.internal.MojoExecutor.executeForkedExecutions (MojoExecutor.java:355)
[ERROR]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:200)
[ERROR]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
[ERROR]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
[ERROR]     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
[ERROR]     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
[ERROR]     at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
[ERROR]     at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
[ERROR]     at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
[ERROR]     at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
[ERROR]     at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
[ERROR]     at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
[ERROR]     at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
[ERROR]     at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
[ERROR]     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
[ERROR]     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
[ERROR]     at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
[ERROR]     at java.lang.reflect.Method.invoke (Method.java:568)
[ERROR]     at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
[ERROR]     at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
[ERROR]     at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
[ERROR]     at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
[ERROR] Caused by: org.apache.maven.plugin.MojoExecutionException: Fatal error compiling
[ERROR]     at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute (AbstractCompilerMojo.java:1191)
[ERROR]     at org.apache.maven.plugin.compiler.TestCompilerMojo.execute (TestCompilerMojo.java:204)
[ERROR]     at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
[ERROR]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
[ERROR]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
[ERROR]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
[ERROR]     at org.apache.maven.lifecycle.internal.MojoExecutor.executeForkedExecutions (MojoExecutor.java:355)
[ERROR]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:200)
[ERROR]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
[ERROR]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
[ERROR]     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
[ERROR]     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
[ERROR]     at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
[ERROR]     at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
[ERROR]     at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
[ERROR]     at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
[ERROR]     at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
[ERROR]     at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
[ERROR]     at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
[ERROR]     at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
[ERROR]     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
[ERROR]     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
[ERROR]     at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
[ERROR]     at java.lang.reflect.Method.invoke (Method.java:568)
[ERROR]     at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
[ERROR]     at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
[ERROR]     at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
[ERROR]     at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
[ERROR] Caused by: org.codehaus.plexus.compiler.CompilerException: error: invalid target release: 21
[ERROR]     at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess (JavaxToolsCompiler.java:179)
[ERROR]     at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile (JavacCompiler.java:169)
[ERROR]     at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute (AbstractCompilerMojo.java:1188)
[ERROR]     at org.apache.maven.plugin.compiler.TestCompilerMojo.execute (TestCompilerMojo.java:204)
[ERROR]     at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
[ERROR]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
[ERROR]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
[ERROR]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
[ERROR]     at org.apache.maven.lifecycle.internal.MojoExecutor.executeForkedExecutions (MojoExecutor.java:355)
[ERROR]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:200)
[ERROR]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
[ERROR]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
[ERROR]     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
[ERROR]     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
[ERROR]     at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
[ERROR]     at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
[ERROR]     at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
[ERROR]     at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
[ERROR]     at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
[ERROR]     at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
[ERROR]     at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
[ERROR]     at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
[ERROR]     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
[ERROR]     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
[ERROR]     at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
[ERROR]     at java.lang.reflect.Method.invoke (Method.java:568)
[ERROR]     at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
[ERROR]     at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
[ERROR]     at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
[ERROR]     at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
[ERROR] Caused by: java.lang.IllegalArgumentException: error: invalid target release: 21
[ERROR]     at com.sun.tools.javac.main.Arguments.error (Arguments.java:905)
[ERROR]     at com.sun.tools.javac.main.Arguments.doProcessArgs (Arguments.java:383)
[ERROR]     at com.sun.tools.javac.main.Arguments.processArgs (Arguments.java:347)
[ERROR]     at com.sun.tools.javac.main.Arguments.init (Arguments.java:246)
[ERROR]     at com.sun.tools.javac.api.JavacTool.getTask (JavacTool.java:191)
[ERROR]     at com.sun.tools.javac.api.JavacTool.getTask (JavacTool.java:119)
[ERROR]     at com.sun.tools.javac.api.JavacTool.getTask (JavacTool.java:68)
[ERROR]     at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess (JavaxToolsCompiler.java:125)
[ERROR]     at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile (JavacCompiler.java:169)
[ERROR]     at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute (AbstractCompilerMojo.java:1188)
[ERROR]     at org.apache.maven.plugin.compiler.TestCompilerMojo.execute (TestCompilerMojo.java:204)
[ERROR]     at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
[ERROR]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
[ERROR]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
[ERROR]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
[ERROR]     at org.apache.maven.lifecycle.internal.MojoExecutor.executeForkedExecutions (MojoExecutor.java:355)
[ERROR]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:200)
[ERROR]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
[ERROR]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
[ERROR]     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
[ERROR]     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
[ERROR]     at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
[ERROR]     at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
[ERROR]     at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
[ERROR]     at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
[ERROR]     at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
[ERROR]     at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
[ERROR]     at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
[ERROR]     at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
[ERROR]     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
[ERROR]     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
[ERROR]     at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
[ERROR]     at java.lang.reflect.Method.invoke (Method.java:568)
[ERROR]     at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
[ERROR]     at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
[ERROR]     at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
[ERROR]     at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
[ERROR] 
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[INFO] 
[INFO] 
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  5.217 s
[INFO] Finished at: 2024-06-05T14:45:36+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.quarkus.platform:quarkus-maven-plugin:3.11.0:update (default-cli) on project pea-backend: The command to update the project exited with an error, see the execution logs above for more details -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Expected behavior

No error message

Actual behavior

Fatal error compiling: error: invalid target release: 21

How to Reproduce?

No response

Output of uname -a or ver

No response

Output of java -version

21.0.3

Quarkus version or git rev

3.8.4

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

No response

gsmet commented 4 months ago

Can you run mvn --version and check that the Java version there is 21? Some people had some issues with this.

Because I don't see why Maven would complain about Java 21 not being supported if you are indeed using Java 21.

codespearhead commented 4 months ago

For what it's worth, I don't get any errors when running the following:

# docker build -t my-image:latest . --progress=plain
ARG QUARKUS_CLI_VERSION=3.11.1
ARG JAVA_VERSION=21.0.3-tem
ARG QUARKUS_BOM_VERSION=3.8.4

FROM registry.access.redhat.com/ubi8/ubi as base
RUN dnf update -y && dnf install -y curl zip && dnf clean all

FROM base as sdkman
RUN curl -s "https://get.sdkman.io" | bash
ENV SDKMAN_DIR="/root/.sdkman"
ENV PATH="${SDKMAN_DIR}/bin:${PATH}"
RUN bash -c "source ${SDKMAN_DIR}/bin/sdkman-init.sh && sdk version"

FROM sdkman as java
ARG JAVA_VERSION
RUN bash -c "source ${SDKMAN_DIR}/bin/sdkman-init.sh && sdk install java ${JAVA_VERSION}"

FROM java as quarkus
ARG QUARKUS_CLI_VERSION
RUN bash -c "source ${SDKMAN_DIR}/bin/sdkman-init.sh && sdk install quarkus ${QUARKUS_CLI_VERSION}"

FROM quarkus as quarkus-app
ARG QUARKUS_BOM_VERSION
RUN bash -c "source ${SDKMAN_DIR}/bin/sdkman-init.sh && quarkus create app --platform-bom=io.quarkus.platform:quarkus-bom:${QUARKUS_BOM_VERSION}"

FROM quarkus-app as quarkus-update
WORKDIR /code-with-quarkus
RUN bash -c "source ${SDKMAN_DIR}/bin/sdkman-init.sh && quarkus update"
Paul6552 commented 3 months ago

@gsmet My output of mvn -version

Apache Maven 3.9.6 (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae) Maven home: /opt/idea-IU-212.5284.40/plugins/maven/lib/maven3 Java version: 21.0.3, vendor: Eclipse Adoptium, runtime: /home/paul/.jdks/temurin-21.0.3 Default locale: de_AT, platform encoding: UTF-8 OS name: "linux", version: "5.15.0-107-generic", arch: "amd64", family: "unix"

//EDIT - More information I uninstalled maven and installed again. Same effect

codespearhead commented 2 months ago

It's always a good idea to check whether the error is reproducible without an IDE, which in this case seems to be the problem as per this answer.

Paul6552 commented 1 month ago

@codespearhead many thanks! This was the error. I checked my modules and they had all different java versions: image

I changed to version 21 and everything worked smooth :-)