-
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
Proper Selection of Execution Environment for Java #1120
Comments
I can reproduce and the issue is https://github.com/mybatis/parent/blob/fcf4376a917a2ccbe72b9dc6de0a6eb99f6c32c5/pom.xml#L612 which sets the m2e-core/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/AbstractJavaProjectConfigurator.java Line 871 in a75554f
|
Actually even m-enforcer-p does not behave like intended, because the full string This is a totally valid version constraint (although its semantics are different than intended). For details refer to https://issues.apache.org/jira/browse/MRESOLVER-306?focusedCommentId=17645347&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-17645347 What is special about this recommended version is that it neither specifies a major nor minor version, therefore the logic added in context of #842 cannot be applied here. |
The attached PR selects JRE environment Java-SE12 for the provided examples, because "11" does not satisfy the requirement (neither with m-enforcer-p), only something like "11.0.1" satisfies the given version constraint but since this cannot be enforced with Java-SE11 the next higher environment is picked. |
mybatis-parent is now fixed as follows: [11,12),[17,18),[19,20),[20,21), this will allow any 11, any 17, any 19, any 20 but nothing else now. Confirmed all the rest, it was allowing any 11 or greater before which was not the intent. Further was able to confirm on github actions as we had 18 still setup which was working until the adjustment then failed as expected. |
For now won't release the mybatis parent so this can be used more for efforts here. We are releasing snapshots to sonatype so as long as you add this snippet at end to project you can run on the 37-SNAPSHOT so both variations can be tested at the moment. If that is not needed, I can move to release it instead.
|
The value is automatically derived from maven-enforcer rule requireJava This closes eclipse-m2e#1134 This closes eclipse-m2e#1120
The value is automatically derived from maven-enforcer rule requireJava Closes eclipse-m2e#1134 Closes eclipse-m2e#1099 Closes eclipse-m2e#1120 Co-authored-by: Hannes Wellmann <wellmann.hannes1@gmx.net>
The value is automatically derived from maven-enforcer rule requireJava Closes eclipse-m2e#1134 Closes eclipse-m2e#1099 Closes eclipse-m2e#1120 Co-authored-by: Hannes Wellmann <wellmann.hannes1@gmx.net>
Please try the latest m2e release to verify that the issue is fixed as expected: |
@HannesWell Looks like we are now in working order. Tried jdk 17, 11, and 8 and all came up as expected on fresh imports. Thank you! Was getting ready to cut our corporate shared Eclipse and give up on this actually so glad to see it land right as I'm doing that in coming days. Appreciate the hard work and hoping also some of the snappiness I'm seeing sticks ;) |
This ticket is an effort to bring together many other tickets that have existed since m2e 2.0 release which has negatively impacted java determination within Eclipse. Example simple projects used here to test out the process.
Related Tickets
Versions used
Test project to be used (small and simple)
The super pom is used across 20 or so underlying projects in separate repos. Mybatis current policy is that we support java 8 runtimes unless override higher on downstream projects. The default is telling the compiler to be java 8. Its using both the legacy source/target and newer release args split for source vs test. Legacy ones used as some plugins still require it. M2e must be concerned of highest java version to use that will correctly work to build. This means across all projects in mybatis it would be 11 because both tests set to that level and many plugins require that level which enforcer further states. The sample caffine-cache project aligns that directly to 11 only overall.
Test import requirements
Current m2e import results
m2e should not consider execution environments that have not be setup which would fix the JRE-1.1 issue. If intent is to always use a execution environment, then alert a warning or error on import that no match is set and direct user to set them up first.
m2e should not longer consider these. In fact, Eclipse really should remove them. While I could potentially still see java 1.5 being used in extreme cases, its implausible that others are and really if those old ones are used, I don't think user should be using any modern IDE.
In the samples provided, expectation is that the following is final resolution
Rules
The text was updated successfully, but these errors were encountered: