nielsbasjes commented on code in PR #11770:
URL: https://github.com/apache/maven/pull/11770#discussion_r3652018667
##########
maven-core/src/main/java/org/apache/maven/toolchain/RequirementMatcherFactory.java:
##########
@@ -79,6 +81,29 @@ public boolean matches(String requirement) {
}
}
+ private VersionRange convertRequirementToVersionRange(String
requirement)
+ throws InvalidVersionSpecificationException {
+ // Specific for Version _requirement_ matching;
+ // If the version is a simple integer (like "25")
+ // then treat this as the requirement "the major version is 25"
+ if (Pattern.matches("^[0-9]+$", requirement)) {
+ int majorVersion = Integer.parseInt(requirement);
+ return VersionRange.createFromVersionSpec("[" + majorVersion +
"," + (majorVersion + 1) + ")");
+ }
+
+ // If the version is a major.minor (like "1.5")
+ // then treat this as the requirement "the major version is 1 and
the minor is 5"
+ if (Pattern.matches("^[0-9]\\.[0-9]+$", requirement)) {
Review Comment:
Yes, good catch. Fixed.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]