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

Split JDK min version from enforcer min version #106

Closed
wants to merge 1 commit into from
Closed

Split JDK min version from enforcer min version #106

wants to merge 1 commit into from

Conversation

TobiX
Copy link
Contributor

@TobiX TobiX commented Jan 9, 2023

This is a "works in most cases" to fix a build error when trying to still preserve Java 8 compatibility.

Context: I'm the maintainer of the sonar-groovy plugin, which still uses this parent. I currently want to keep Java 8 compatibility, while updating the build infrastructure. (See Inform-Software/sonar-groovy#170)

The problem is now this:

  • The javac release flag only accepts versions in the "modern" style, so 6, 7, 8, 9, 10, 11
  • The enforcer rule requireJavaVersion builds a range restriction against a normalized version of the build JDK, which is something like 1.8.0-352 or 11.0.17

So using 1.8 as jdk.min.version breaks the compiler on Java 11 and using 8 as jdk.min.version makes the enforcer plugin throw an error on Java 8 (since 8 > 1.8).

Splitting this into two properties (with one deriving from the other by default) serves two purposes:

  • It's good enough for most users: For example, setting jdk.min.version to 11 creates a version enforcer.jdk.min.version of 1.11, which is still bigger then 1.8 and smaller then 11 (and we are pretty sure nobody uses anything in-between)
  • If one wants to be hyper-correct (or require a different Java version for maven/enforcer and compiler), one can still overwrite both properties

This can probably be dropped some months after the next LTS release, when Java 11 is the baseline for all projects based on this.

@TobiX TobiX requested a review from a team as a code owner January 9, 2023 16:43
@sebastienvermeille
Copy link
Contributor

Hi @TobiX
First I would like to apologize, this PR was not treated in a reasonable time.

Thank you very much for your contribution it is very appreciated. I will do my best at my humble level to ensure such PRs do not take so long to be reviewed.

As Java11 is now the baseline, this PR is no longer required.

Best,
Seb

@TobiX TobiX deleted the enforcer-min-version-workaround branch September 28, 2023 14:04
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 this pull request may close these issues.

2 participants