-
Notifications
You must be signed in to change notification settings - Fork 117
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
Java version mismatch between JRE_CONTAINER and targetPlatform in M2E 2.0.0 #842
Comments
Can you please provide steps to reproduce with plain Eclipse m2e? Or even better, as a unit test for org.eclipse.m2e.jdt.tests ? |
I am able to reproduce with : Version: 2022-06 (4.25) This does not occur with the 1.x m2e : M2E - Maven Integration for Eclipse (includes Incubating components) 1.20.1.20220227-1319 org.eclipse.m2e.feature.feature.group Eclipse.org - m2e I just had to add a Java 1.8 JDK to "Installed JREs" so that it may be detected (if needed). Otherwise, you'll see the runtime as JavaSE-1.8 (with an incompatible JDK underlying it which is a warning by default) The pom file does have a profile :
Is this just a regression in detecting the Java runtime from the profile ? |
There are two different potential environment ids relevant: m2e-core/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/AbstractJavaProjectConfigurator.java Line 175 in 8b876a6
getMinimumJavaBuildEnvironmentId() is used preferably and determined from the minimum Java enforced through m-enforcer-p while getExecutionEnvironmentId() is driven from maven-compiler-plugin settings (logic introduced in #590).
In this case the enforced Java version seems to be 8 (set via https://repo1.maven.org/maven2/org/mybatis/mybatis-parent/34/mybatis-parent-34.pom). The profile with id Not sure if the logic should be improved that always the higher execution id is being taken instead of the one from the m-enforcer-p first.... |
m-compile-p and m-enforcer-p parametrisation This closes eclipse-m2e#842
And why does this return 16 here? |
Because the profile with id m2e-core/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/AbstractJavaProjectConfigurator.java Line 790 in 8b876a6
|
ah ok, I didn't notice this profile had an auto-activation set. But the properties it sets are for tests, so shouldn't those be ignored ? |
All mojo executions are considered at m2e-core/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/AbstractJavaProjectConfigurator.java Line 612 in 8b876a6
|
OK, so that's probably the root cause of the bug. The test executions should be skipped. |
Not sure, if maven-enforcer enforces a lower version, but you have a profile (conditionally activated) setting the target of the compiler (not only for test) to a higher version you also run into this issue. So in general the JRE container should be the highest one from the different parameterisations. |
That's not really the case here as only test config is overridden and there is no reason that the test config is used to derive main project settings. Moreover a pom setup that mixes different version in enforcer and main compilation would be inconsistent even from Maven POV, so no need to worry further about it in m2e. |
@mickaelistria In this way, IIUC both the project's compliance and the JRE container of that sample project would be set to 1.8 since only the default compilation considered, right? And can we do something with the tests in source level 16? |
Yes.
No. JDT cannot be configured to compile the sources from a given project with different compiler options (eg source level). Changing that would require a fair amount of work in JDT, to move the various options from project-scope only to source-folder scope. Then, when JDT can do it, m2e can leverage it. |
Yeah, and I'm thinking since JDT use the same compiler option for a project, why not use the highest version between them, as @kwin 's new proposal? I can imagine that if we set the source compiler level of the project to 1.8, users will encounter errors about |
I don't think that it needs to be that complex, JDT already distinguish between "main" and "test" sources and even classpath entries and seem to compile them differently, so it seems possible to even use a different compiler level then for test sources. |
At least via UI that option is not exposed in Eclipse and having some options for compilation which are not exposed in UI calls for trouble as there is too much magic in it then. |
I don't think it is currently possible, just not that we need a setting per source folder as indicated by @mickaelistria
Compiling code with higher JVM level could also be a source of problems as it might "leak" into your Java 1.8 code. |
AFAIK JDT indeed distinguish these two sources but can't use different options to compile them, and only compiler prefs such as "org.eclipse.jdt.core.compiler.compliance" can be found. @laeubi could you please explain a little bit? @mickaelistria what do you think of this? |
JDT needs to be enhanced to have e.g. |
The purpose of the enforcer rule is to set a range of acceptable versions, e.g. "Java 8 and above" or "Any Java version between 7 and 11". If that condition is not met, the enforcer rule does not adjust compilation target - it simply aborts the build process. As it is right now, the Build Process would state "I'm compiling with Java 11 for Java 11. I'm also verifying that both of these versions are newer than Java 8" and m2e would go "Clearly we should use Java 8 to run this then" - in essence turning a rule that says "At least one version in range must be able to compile and run the code" into "The lowest version in range must be able to compile and run the code" which is not a bug in the |
This is just not possible, as the compiler uses the same JDK as the rest of the build by default. And Java 8 cannot compile for Java 11. |
I'm the maintainer of the mybatis projects maven builds. The parent pom is set to detect m2e.version property. Does that even exist still? This worked prior to 2.x m2e jump. Via this profile (from https://github.com/mybatis/parent/blob/master/pom.xml)
So the issue here should be setting the entire thing to jdk 16 as required for mybatis-3 to compile tests at least and known that it all must go there even though bulk is jdk 8 based code. We have also moved off using jdk 8 at all for builds now. So currently, a fresh import of mybatis-3 shows up with JavaSE-12 being selected. I'm unclear where 12 is even coming from. The required java version in parent on enforcer plugin is an allowable range 11, 17, 18, 19, 20 in our latest. |
As far as I know nothing has changed here. The JVM itself are configured under What m2e actually has derived, should be stored in |
Tycho can compile with any java version, also plain maven can do this, using configured toolchains. |
ok the file itself shows 16. odd though its not selecting that in the ide. |
You are misunderstanding me. I'm not saying to use Java 8 to compile for Java 11. I say it is possible that you enforce a minimum of Java 8, but are actually using Java 11. Again, it is not the job of the enforcer rule to set the used Java version. It's the job of the enforcer rule to validate that the used Java version follows the given guidelines. So m2e ignoring the actually used version in the build and instead utilizing the enforced minimum version is simply wrong behavior, ignoring something explicitly set for a minimum it basically guesses. |
The version being given in rule The exact source code is in m2e-core/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/AbstractJavaProjectConfigurator.java Lines 878 to 897 in 8b876a6
Feel free to suggest how to better support this edge case. |
@kwin thanks for your reply. Setting
Leaving that version range aspect aside for a moment, my major gripe is that m2e shouldn't fall back to a JVM that's not even installed. |
What should happen if Eclipse doesn't find a compatible JRE for the identified minimum execution environment from your PoV? |
Maybe we need to check for https://help.eclipse.org/latest/topic/org.eclipse.jdt.doc.isv/reference/api/org/eclipse/jdt/launching/environments/IExecutionEnvironment.html#getCompatibleVMs() in m2e-core/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/AbstractJavaProjectConfigurator.java Line 259 in 8b876a6
|
Fix evaluation of expressions in m-enforcer-p parameter Only select ExecutionEnvironments with at least one compatible VM installed. This closes eclipse-m2e#842
Fix evaluation of expressions in m-enforcer-p parameter Only select ExecutionEnvironments with at least one compatible VM installed. This closes eclipse-m2e#842
Fix evaluation of expressions in m-enforcer-p parameter Only select ExecutionEnvironments with at least one compatible VM installed. This closes eclipse-m2e#842
Fix evaluation of expressions in m-enforcer-p parameter Only select ExecutionEnvironments with at least one compatible VM installed. This closes eclipse-m2e#842
Fix evaluation of expressions in m-enforcer-p parameter Only select ExecutionEnvironments with at least one compatible VM installed. This closes eclipse-m2e#842
Fix evaluation of expressions in m-enforcer-p parameter Only select ExecutionEnvironments with at least one compatible VM installed. This closes eclipse-m2e#842
Fix evaluation of expressions in m-enforcer-p parameter Only select ExecutionEnvironments with at least one compatible VM installed. This closes eclipse-m2e#842
Fix evaluation of expressions in m-enforcer-p parameter Only select ExecutionEnvironments with at least one compatible VM installed. This closes eclipse-m2e#842 Also-by: Hannes Wellmann <wellmann.hannes1@gmx.net>
Fix evaluation of expressions in m-enforcer-p parameter Only select ExecutionEnvironments with at least one compatible VM installed. This closes #842 Also-by: Hannes Wellmann <wellmann.hannes1@gmx.net>
Is this issue completely fixed with #981? |
The error reports are all a bit fuzzy here, so the only thing which has actually changed with #981 is that only Java versions which have a compliant installed JRE are selected and that minor versions are disregarded (because Eclipse only distinguishes OSGi execution environments, i.e. major Java versions) |
@HannesWell Issue is not resolved. With latest m2e 2.1.3, its now importing fresh project noted here as JRE-1.1 and then setting that to jdk 17. JRE-1.1 is not setup for any execution environment and java version was set to 11. It really should not be using enforcer plugin to guess its way to glory. The compiler args already told it what version. This is a large problem when super poms support wide ranges. |
note: 17 picked above as its the default in my Eclipse. Other concerns still stand, it picks wrong execution environment. |
A lot of different issues have been reported in this ticket. If still a JRE is picked which is not the enforced Java version or the target version then I would suggest to create a new ticket, with detailed information/example pom and expected JRE version and actual JRE version. |
OK. Could it be that you have the same issue like in #1099? I'm about to look into that. In general, from my understanding (also influenced by this discussion) of how to use the enforcer-plugin and the
Does anybody disagree with that analysis? @Bananeweizen maybe you are interested in this discussion as well. |
It's simple. Enforcer just states a level that must be used to even build. So say jdk 11. It typically has a range that are known to work. However m2e only cares about what must be used to work. Without Enforcer it should use source or release. Target doesn't matter as one cannot compile upwards. This broke with m2e 2.x. it's now not selecting correct execution environment at 2.1.3. It is working now at least in my case as default jdk was 17 but I have 8, 11, 17, 19, and 20 defined as execution environments and expected 11 not 1 from execution list. I kind of question why eclipse has such old entries but don't feel m2e should even consider those.
A diagram probably would help map this out properly. Also, probably rechecking why 2.x broke in this way.
Sent from my Verizon, Samsung Galaxy smartphone
Get Outlook for Android<https://aka.ms/AAb9ysg>
…________________________________
From: Hannes Wellmann ***@***.***>
Sent: Saturday, December 3, 2022 5:15:44 PM
To: eclipse-m2e/m2e-core ***@***.***>
Cc: Jeremy Landis ***@***.***>; Comment ***@***.***>
Subject: Re: [eclipse-m2e/m2e-core] Java version mismatch between JRE_CONTAINER and targetPlatform in M2E 2.0.0 (Issue #842)
@HannesWell<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FHannesWell&data=05%7C01%7C%7Ccf5880130d7a4ab3422308dad57becdc%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638057025516720348%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=xMXhk7IiFQgvLR7t4d%2FCDggs1XhaIvsdAedEGt90kC8%3D&reserved=0> Issue is not resolved. With latest m2e 2.1.3, its now importing fresh project noted here as JRE-1.1 and then setting that to jdk 17. JRE-1.1 is not setup for any execution environment and java version was set to 11. It really should not be using enforcer plugin to guess its way to glory. The compiler args already told it what version. This is a large problem when super poms support wide ranges.
OK. Could it be that you have the same issue like in #1099<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Feclipse-m2e%2Fm2e-core%2Fissues%2F1099&data=05%7C01%7C%7Ccf5880130d7a4ab3422308dad57becdc%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638057025516720348%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=DX6ZBggDHatPJ2Z%2F0OC6dwTn0AYIWoqGnw4DXfQVdWY%3D&reserved=0>? I'm about to look into that.
In general, from my understanding (also influenced by this discussion) of how to use the enforcer-plugin and the source/target/release properties of the maven-compiler-plugin I think M2E should do the following:
* Configure the JDT ...compiler.source/...compiler.codegen.targetPlatform/...compiler.release preferences according to the corresponding configuration of the maven-compiler-plugin.
* In general set the JRE_CONTAINER in the project's .classpath to the value of the source/target/release properties of the `maven-compiler-plugin
* in case of different versions, release wins, and if only source and target are specified the higher of both is used?
* If a enforcer-plugin execution with requireJavaVersion rule is configured and that rule requires a higher Java version than specified by the compiler-plugin, then the lowest possible java (major) version that satisfies the rule's version range should be set as JRE_CONTAINER.
Personally I never really used the enforcer plugin yet, but from my understanding it is used to enforce the usage of a JDK with a higher version than the targeted Java version when building the sources. Since one cannot target more recent java versions than the JDK used to build is of, the compiler-plugin settings are the minimum. And reasonably the enforcer-plugin can only require the usage of more recent JDKs (for whatever reason). Therefore I think the suggested approach would best mimic the behavior of the build.
Does anybody disagree with that analysis?
If this is the desired behavior the second step is to make sure M2E acts accordingly.
@Bananeweizen<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FBananeweizen&data=05%7C01%7C%7Ccf5880130d7a4ab3422308dad57becdc%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638057025516720348%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=D4lz3C%2Ben9qCyWG%2Bl6KRSKOtyeKqPhgdMOj1SG61THY%3D&reserved=0> maybe you are interested in this discussion as well.
—
Reply to this email directly, view it on GitHub<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Feclipse-m2e%2Fm2e-core%2Fissues%2F842%23issuecomment-1336268152&data=05%7C01%7C%7Ccf5880130d7a4ab3422308dad57becdc%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638057025516720348%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=W6NqW%2BDFArt8lH%2BEMP1Ob18DRzvNx9qvzcvBOnVWIwY%3D&reserved=0>, or unsubscribe<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAAHODI6ZTX6DAI4QOOFZJDLWLPBBBANCNFSM52Y3JOVA&data=05%7C01%7C%7Ccf5880130d7a4ab3422308dad57becdc%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638057025516720348%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=VUNHn%2Flea41OX7Kc5NjAJryL28HMUgCUXOb8rnuTrSs%3D&reserved=0>.
You are receiving this because you commented.Message ID: ***@***.***>
|
Didn't tycho move to java 17? Their latest tools from what I recall did so other issue seems valid as to 17 in general.
Sent from my Verizon, Samsung Galaxy smartphone
Get Outlook for Android<https://aka.ms/AAb9ysg>
…________________________________
From: Jeremy Landis ***@***.***>
Sent: Saturday, December 3, 2022 7:12:59 PM
To: eclipse-m2e/m2e-core ***@***.***>; eclipse-m2e/m2e-core ***@***.***>
Cc: Comment ***@***.***>
Subject: Re: [eclipse-m2e/m2e-core] Java version mismatch between JRE_CONTAINER and targetPlatform in M2E 2.0.0 (Issue #842)
It's simple. Enforcer just states a level that must be used to even build. So say jdk 11. It typically has a range that are known to work. However m2e only cares about what must be used to work. Without Enforcer it should use source or release. Target doesn't matter as one cannot compile upwards. This broke with m2e 2.x. it's now not selecting correct execution environment at 2.1.3. It is working now at least in my case as default jdk was 17 but I have 8, 11, 17, 19, and 20 defined as execution environments and expected 11 not 1 from execution list. I kind of question why eclipse has such old entries but don't feel m2e should even consider those.
A diagram probably would help map this out properly. Also, probably rechecking why 2.x broke in this way.
Sent from my Verizon, Samsung Galaxy smartphone
Get Outlook for Android<https://aka.ms/AAb9ysg>
________________________________
From: Hannes Wellmann ***@***.***>
Sent: Saturday, December 3, 2022 5:15:44 PM
To: eclipse-m2e/m2e-core ***@***.***>
Cc: Jeremy Landis ***@***.***>; Comment ***@***.***>
Subject: Re: [eclipse-m2e/m2e-core] Java version mismatch between JRE_CONTAINER and targetPlatform in M2E 2.0.0 (Issue #842)
@HannesWell<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FHannesWell&data=05%7C01%7C%7Ccf5880130d7a4ab3422308dad57becdc%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638057025516720348%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=xMXhk7IiFQgvLR7t4d%2FCDggs1XhaIvsdAedEGt90kC8%3D&reserved=0> Issue is not resolved. With latest m2e 2.1.3, its now importing fresh project noted here as JRE-1.1 and then setting that to jdk 17. JRE-1.1 is not setup for any execution environment and java version was set to 11. It really should not be using enforcer plugin to guess its way to glory. The compiler args already told it what version. This is a large problem when super poms support wide ranges.
OK. Could it be that you have the same issue like in #1099<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Feclipse-m2e%2Fm2e-core%2Fissues%2F1099&data=05%7C01%7C%7Ccf5880130d7a4ab3422308dad57becdc%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638057025516720348%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=DX6ZBggDHatPJ2Z%2F0OC6dwTn0AYIWoqGnw4DXfQVdWY%3D&reserved=0>? I'm about to look into that.
In general, from my understanding (also influenced by this discussion) of how to use the enforcer-plugin and the source/target/release properties of the maven-compiler-plugin I think M2E should do the following:
* Configure the JDT ...compiler.source/...compiler.codegen.targetPlatform/...compiler.release preferences according to the corresponding configuration of the maven-compiler-plugin.
* In general set the JRE_CONTAINER in the project's .classpath to the value of the source/target/release properties of the `maven-compiler-plugin
* in case of different versions, release wins, and if only source and target are specified the higher of both is used?
* If a enforcer-plugin execution with requireJavaVersion rule is configured and that rule requires a higher Java version than specified by the compiler-plugin, then the lowest possible java (major) version that satisfies the rule's version range should be set as JRE_CONTAINER.
Personally I never really used the enforcer plugin yet, but from my understanding it is used to enforce the usage of a JDK with a higher version than the targeted Java version when building the sources. Since one cannot target more recent java versions than the JDK used to build is of, the compiler-plugin settings are the minimum. And reasonably the enforcer-plugin can only require the usage of more recent JDKs (for whatever reason). Therefore I think the suggested approach would best mimic the behavior of the build.
Does anybody disagree with that analysis?
If this is the desired behavior the second step is to make sure M2E acts accordingly.
@Bananeweizen<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FBananeweizen&data=05%7C01%7C%7Ccf5880130d7a4ab3422308dad57becdc%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638057025516720348%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=D4lz3C%2Ben9qCyWG%2Bl6KRSKOtyeKqPhgdMOj1SG61THY%3D&reserved=0> maybe you are interested in this discussion as well.
—
Reply to this email directly, view it on GitHub<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Feclipse-m2e%2Fm2e-core%2Fissues%2F842%23issuecomment-1336268152&data=05%7C01%7C%7Ccf5880130d7a4ab3422308dad57becdc%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638057025516720348%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=W6NqW%2BDFArt8lH%2BEMP1Ob18DRzvNx9qvzcvBOnVWIwY%3D&reserved=0>, or unsubscribe<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAAHODI6ZTX6DAI4QOOFZJDLWLPBBBANCNFSM52Y3JOVA&data=05%7C01%7C%7Ccf5880130d7a4ab3422308dad57becdc%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638057025516720348%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=VUNHn%2Flea41OX7Kc5NjAJryL28HMUgCUXOb8rnuTrSs%3D&reserved=0>.
You are receiving this because you commented.Message ID: ***@***.***>
|
I think there are actually two levels:
|
If enforcer says to use 11 while compile says 8. There is a bigger reason. Plugins likely require 11 to function so rather than build failing with class version issue, it fails with nicer error to use 11 or better usually in a range. The mybatis setup is correct. I wrote it. Same setup is in many other projects. It has extra enforcer rules along with release that enforces binary compatibility. Use that as a guideline since it was brought up originally by others. That same setup I have on 1k repos or more at my day job via super pom. Try the build at command line. Use jdk8. It will fail telling you to use 11 or better. Use 11 it works, try 17, 19, 20ea, all work. See github actions, all executed, all valid. So m2e should react the same there. It has the range. It should know to attempt the right minimum match. If it cannot match it should not import and should tell user why. Enforcer is just a hint on ranges that compiler must use. The compiler with source or release arg must also be at least the level of enforcer rule allows. So let's say compiler say 17 in such case and enforcer says 11, 17, or 19. Then clearly it must be 17. If no enforcer the again must be 17 in this example.
Further note that tests can actually split from normal compiler args. So tests could also further say even higher version still and that has to win out. So back to my example if tests say they need 19, enforcer said ok range included 19, and compiler says 17, then 19 must be used.
Will open a new ticket. Include all related flags in clear way and link back here later today.
Sent from my Verizon, Samsung Galaxy smartphone
Get Outlook for Android<https://aka.ms/AAb9ysg>
…________________________________
From: Christoph Läubrich ***@***.***>
Sent: Sunday, December 4, 2022 12:34:11 AM
To: eclipse-m2e/m2e-core ***@***.***>
Cc: Jeremy Landis ***@***.***>; Comment ***@***.***>
Subject: Re: [eclipse-m2e/m2e-core] Java version mismatch between JRE_CONTAINER and targetPlatform in M2E 2.0.0 (Issue #842)
Does anybody disagree with that analysis?
I think there are actually two levels:
1. Compile time (and that's what JRE_CONTAINER maps to and I don't see a reason why enforcer should have any influences here...)
2. Runtime (e.g. running the tests from within eclipse, running a main-class, ...) where enforcer becomes relevant.
—
Reply to this email directly, view it on GitHub<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Feclipse-m2e%2Fm2e-core%2Fissues%2F842%23issuecomment-1336326607&data=05%7C01%7C%7C51e8e02cc4d8462e6e0e08dad5b92cc4%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638057288553464518%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Xyo8FhnVQZlXh2gEjvyHIlFf7%2F3ebfIyM%2FM3TW3Su%2FE%3D&reserved=0>, or unsubscribe<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAAHODI5CDBHL6P7DRT5CB73WLQUNHANCNFSM52Y3JOVA&data=05%7C01%7C%7C51e8e02cc4d8462e6e0e08dad5b92cc4%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638057288553464518%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=hOok5RucGImS5uxm7d2zmFLdDlb1lS%2B1c%2F3efcvoDDA%3D&reserved=0>.
You are receiving this because you commented.Message ID: ***@***.***>
|
Opened #1120 that should help this entirely and has sample projects which the most broken up configuration between src/test and legacy vs modern setup and small project samples on live projects that have been configured as such for a long time and should be ideal in helping understand all this. |
steps to reproduce:
Item
record under packageorg.apache.ibatis.submitted.record_type
.as we know, record should be available in Java 16 but not in Java 8.
.classpath
file, the JRE_CONTAINER is set to JavaSE-1.8 VM..settings/org.eclipse.jdt.prefs
file, 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)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:
cc: @fbricon @rgrunber
The text was updated successfully, but these errors were encountered: