You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "elharo (via GitHub)" <gi...@apache.org> on 2026/07/22 11:22:26 UTC
[I] Version matching is inverted in SelectJdkToolchainMojo.matches() for VERSION key [maven-toolchains-plugin]
elharo opened a new issue, #167:
URL: https://github.com/apache/maven-toolchains-plugin/issues/167
## Summary
The method in passes arguments in the wrong order to . This means version constraints specified via will not produce correct matching.
## Location
https://github.com/apache/maven-toolchains-plugin/blob/master/src/main/java/org/apache/maven/plugins/toolchain/jdk/SelectJdkToolchainMojo.java#L187-L191
## Code
Here is the toolchain's version value and is the user's requirement (e.g., "[11,17)").
## Problem
The standard Maven Toolchain API pattern (as used internally by ) is:
1. Create a version range matcher from the **requirement** value
2. Check if the **toolchain's provides** value is within that range
This code does the opposite: it creates a version range from the toolchain's concrete version (which is a specific value, not a range) and checks if the requirement string is within it. The semantics are inverted.
For example, with a toolchain version "11.0.1" and a requirement "[11,17)":
- Expected: "11.0.1" is within range "[11,17)" -> match
- Actual: creates range "11.0.1" (which is just the single version 11.0.1) and checks if "[11,17)" is within 11.0.1 -> likely no match
## Impact
The goal's parameter will not correctly match JDK toolchains. Users specifying version ranges will get unexpected "Cannot find matching toolchain" failures.
## Suggested Fix
Swap the arguments:
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Version matching is inverted in SelectJdkToolchainMojo.matches() for VERSION key [maven-toolchains-plugin]
Posted by "elharo (via GitHub)" <gi...@apache.org>.
elharo closed issue #167: Version matching is inverted in SelectJdkToolchainMojo.matches() for VERSION key
URL: https://github.com/apache/maven-toolchains-plugin/issues/167
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org