slawekjaranowski commented on code in PR #1337:
URL: https://github.com/apache/maven/pull/1337#discussion_r1419475500


##########
maven-core/src/main/java/org/apache/maven/plugin/internal/MavenPluginMavenPrerequisiteChecker.java:
##########
@@ -48,16 +57,35 @@ public void accept(PluginDescriptor pluginDescriptor) {
                 requiredMavenVersion == null || 
requiredMavenVersion.trim().isEmpty();
 
         if (!isBlankVersion) {
-            boolean isRequirementMet = false;
+            VersionScheme versionScheme = versionSchemeProvider.get(); // this 
must happen within session
+            VersionConstraint constraint;
             try {
-                isRequirementMet = 
runtimeInformation.isMavenVersion(requiredMavenVersion);
-            } catch (IllegalArgumentException e) {
+                constraint = 
versionScheme.parseVersionConstraint(requiredMavenVersion);
+            } catch (InvalidVersionSpecificationException e) {
                 logger.warn(
                         "Could not verify plugin's Maven prerequisite as an 
invalid version is given in "
                                 + requiredMavenVersion,
                         e);
                 return;
             }
+
+            Version current;
+            try {
+                String mavenVersion = runtimeInformation.getMavenVersion();
+                if (mavenVersion == null || mavenVersion.isEmpty()) {
+                    throw new IllegalArgumentException("Could not determine 
current Maven version");
+                }
+                current = versionScheme.parseVersion(mavenVersion);

Review Comment:
   What do you think, to make a `runtimeInformation.getMavenVersion` returning 
`Version` type instead of String?
   or better new method in runtimeInformation



-- 
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-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to