-
Notifications
You must be signed in to change notification settings - Fork 125
Description
steps to reproduce:
- given sample project: https://github.com/mybatis/mybatis-3.git
- open it in VS Code, with redhat.java extension 1.8.0 installed (which integrates m2e 2.0.0 snapshot).
- after project imported, VS Code reports an error in
Itemrecord under packageorg.apache.ibatis.submitted.record_type.
java.lang.Record cannot be resolved to a type.
as we know, record should be available in Java 16 but not in Java 8.
- check the generated
.classpathfile, the JRE_CONTAINER is set to JavaSE-1.8 VM.
classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"
- check the generated
.settings/org.eclipse.jdt.prefsfile, the target platform is set to Java 16 (which would be the expect source level since it's defined in https://github.com/mybatis/mybatis-3/blob/9da3467e96a03e8bd6e040139581a22ce5297c29/pom.xml#L449-L459)
org.eclipse.jdt.core.compiler.codegen.targetPlatform=16
org.eclipse.jdt.core.compiler.compliance=16
org.eclipse.jdt.core.compiler.source=16
if we rollback to redhat.java 1.6.0, which uses m2e 1.18.2, this issue disappears. The JRE_CONTAINER in .classpath file is JavaSE-16, and the value of pref org.eclipse.jdt.core.compiler.codegen.targetPlatform is also 16.
I think this issue might related to #597 which introduces a new limitation from maven-enforcer-plugin. But I'm not sure it's caused by the plugin or m2e itself. When debugging, the two environments seem to mismatch:
