gnodet commented on code in PR #2116: URL: https://github.com/apache/maven/pull/2116#discussion_r1964025913
########## impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/BaseParser.java: ########## @@ -352,6 +352,22 @@ protected Map<String, String> populateSystemProperties(LocalContext context) { String mavenVersion = buildProperties.getProperty(CLIReportingUtils.BUILD_VERSION_PROPERTY); systemProperties.setProperty("maven.version", mavenVersion); + boolean snapshot = mavenVersion.endsWith("SNAPSHOT"); + if (snapshot) { + mavenVersion = mavenVersion.substring(0, mavenVersion.length() - "SNAPSHOT".length()); + if (mavenVersion.endsWith("-")) { + mavenVersion = mavenVersion.substring(0, mavenVersion.length() - 1); + } + } + String[] versionElements = mavenVersion.split("\\."); + if (versionElements.length != 3) { + throw new IllegalStateException("Maven version is expected to have 3 segments: '" + mavenVersion + "'"); + } + systemProperties.setProperty("maven.version.major", versionElements[0]); Review Comment: Those need to be in `Constants` so that they are documented properly. -- 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