Skip to content

Introduce a majorVersion property #142

@HannesWell

Description

@HannesWell

New feature, improvement proposal

The existing version parameter of the select-jdk-toolchain goal current requires one to specify a version range or an exact version.
As far as I can tell it's not possible to specify just the desired major version.
If I want to have any JDK-21 (but only 21) I have to specify the version as [21,22).

This is easy for hard-coded versions, but if the version is derived from another parameter (e.g. maven.compiler.release), then one needs to start calculating in the configuration and that's not trivial with Maven.

Therefore my proposal is to introduce something like a majorVersion parameter that expects an integer number and is internally translated into a version requirement of [${majorVersion},${majorVersion+1}).

This would be similar to the version element in a JDK toolchain:
https://maven.apache.org/plugins/maven-toolchains-plugin/toolchains/jdk.html

In general it would be possible to make the exiting version parameter behave like a majorVersion field in case it has a integer value. But maybe this would break existing users that expect the current behavior?

If you agree I can provide a PR for it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions