apache / apache/maven-toolchains-plugin

Introduce a majorVersion property

Open
#142 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Java
Stars
27
Forks
31
PR merge metrics
No merged PRs in 30d

Description

### New feature, improvement proposal

The existing [`version`](https://maven.apache.org/plugins/maven-toolchains-plugin/select-jdk-toolchain-mojo.html#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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.