Description
Hello,
I have Java 21 installed on my machine. I have a maven project for which preview features are enabled (<compilerArgs>--enable-previev</compilerArgs>
in the configuration of the compiler plugin).
Previously it worked fine, but now if I try to run a main
method in the prject by clicking the play button in the UI (or Run
that appears above the method signature), I get the error Preview features enabled at an invalid source release level 21, preview can be enabled only at source level 22
from the VSCode. The error does not happen when I run maven from the terminal (mvn compile
).
Explicitly specifying the runtime in the VSCode settings did not solve the issue. Is there anything else I can do?
Thanks
Environment
- Operating System: Ubuntu 22.04
- JDK version: 21.0.3
- Visual Studio Code version: 4.89.0
- Java extension version: 1.30.0
Steps To Reproduce
- Have a maven project with preview features enabled and source version set to 21
- Try to run a
main()
method from the UI.
Current Result
Error Preview features enabled at an invalid source release level 21, preview can be enabled only at source level 22
.
Expected Result
Project should build and run as Java 21 is installed on the system