You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, since I updated my Maven modules to use JUnit 6 I've got problems running the tests with VS Code if the module is configured to cross-compile to Java 11.
My Maven modules use this configuration to make sure the compiled artifacts run on Java 11 environments:
Based on this config, VS Code automatically adds my local JDK 11 installation as a classpath dependency although I also have Java 21 installed as well.
Now, when I try to run any unit test in VS Code I get the following output in the Debug Console:
java.lang.UnsupportedClassVersionError: org/eclipse/jdt/internal/junit6/runner/JUnit6TestLoader 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
I know that I can solve this problem by setting the JDK Runtime to "JavaSE-21" per module. But I have dozens of projects with dozens of modules and setting the JDK runtime for each of them manually is tedious. So I wonder if there is another way to get test execution in VS Code working without setting the JDK Runtime a hundred times.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, since I updated my Maven modules to use JUnit 6 I've got problems running the tests with VS Code if the module is configured to cross-compile to Java 11.
My Maven modules use this configuration to make sure the compiled artifacts run on Java 11 environments:
Based on this config, VS Code automatically adds my local JDK 11 installation as a classpath dependency although I also have Java 21 installed as well.
Now, when I try to run any unit test in VS Code I get the following output in the Debug Console:
I know that I can solve this problem by setting the JDK Runtime to "JavaSE-21" per module. But I have dozens of projects with dozens of modules and setting the JDK runtime for each of them manually is tedious. So I wonder if there is another way to get test execution in VS Code working without setting the JDK Runtime a hundred times.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions