[ https://issues.apache.org/jira/browse/MNG-7950?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17794422#comment-17794422 ]
ASF GitHub Bot commented on MNG-7950: ------------------------------------- cstamas commented on code in PR #1337: URL: https://github.com/apache/maven/pull/1337#discussion_r1419569071 ########## 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: No, in Maven the type `Version` can be parsed only within session (as session is used to choose schema). RTInfo participates in places like `mvn -v`, where there is no session nor should be session at all. So it would be chicken or egg situation. RTInfo is good as is, all it should do is expose String version, and let anyone interested in it possibly parse/compare/whatever. > Support new version scheme selector in Maven > -------------------------------------------- > > Key: MNG-7950 > URL: https://issues.apache.org/jira/browse/MNG-7950 > Project: Maven > Issue Type: Task > Components: Artifacts and Repositories > Reporter: Tamas Cservenak > Assignee: Tamas Cservenak > Priority: Major > Fix For: 4.0.0-alpha-9, 4.0.0 > > > The generic version scheme is made into component, but it is not enough: > there should be an indirection and extension point to support multiple > schemes. > Resolver introduces MRESOLVER-446 for that. > There is one component in Maven maven-resolver-provider module that needs to > be adapted, and use selector instead of ctor passed in scheme. -- This message was sent by Atlassian Jira (v8.20.10#820010)