Skip to content
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

Invalid value passed to m-enforcer-p rule "requireJavaVersion" #401

Closed
kwin opened this issue Dec 9, 2022 · 4 comments · Fixed by #402
Closed

Invalid value passed to m-enforcer-p rule "requireJavaVersion" #401

kwin opened this issue Dec 9, 2022 · 4 comments · Fixed by #402

Comments

@kwin
Copy link

kwin commented Dec 9, 2022

Only version ranges according to https://maven.apache.org/enforcer/enforcer-rules/requireJavaVersion.html and https://maven.apache.org/enforcer/enforcer-rules/versionRanges.html are supported but currently just a comma separated list of major versions are passed in

parent/pom.xml

Line 612 in fcf4376

<version>${allowed.build.jdks}</version>
.

Although this works for requiring a lower bound (more or less by incident, for details refer to eclipse-m2e/m2e-core#1120) it doesn't work for enforcing the upper bound properly. Also it won't accept version "11" but only a minor version above 0!
This value must either be a single version (for just requiring a minimum version) or a range starting with either ( or [.

@hazendaz
Copy link
Member

hazendaz commented Dec 9, 2022 via email

@hazendaz
Copy link
Member

ok looking at this and testing. Enforcer actually does allow this. It ranges what is listed. It seems to allow any 11 through 20 which is evidenced by our github action builds. If I remove 17 for example, it continues to allow that because 11 through 20 still listed and those each allow full ranges. Not quite what is expected but it isn't exactly wrong. This is actually additionally shown on https://maven.apache.org/enforcer/enforcer-rules/versionRanges.html stating it will use any version listed at that revision. Still going to fix it up and do some more testing but at least noting it does work for the most part but ranging further than expected. Expectation here is to only allow those jdks and not ones removed such as 18.

@hazendaz
Copy link
Member

ok got PR adjusting the rule. The prior just allowed anything >= 11. New rule will enforce any 11, any 17, any 19, any 20 and nothing else.

@kwin
Copy link
Author

kwin commented Dec 10, 2022

It was a valid version constraint but not what you expected. Look at https://issues.apache.org/jira/browse/MRESOLVER-306?focusedCommentId=17645347&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-17645347 for details. For example version 11 was not accepted either but only 11.0.x. The comma separated list was rather interpreted as a single version containing some comma

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants