Bukama commented on code in PR #2116: URL: https://github.com/apache/maven/pull/2116#discussion_r1958480925
########## 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 + "'"); Review Comment: I'm curious if this plays out. YES - Maven is based on SemVer 1.0.0 (see https://maven.apache.org/guides/mini/guide-naming-conventions.html) which does know build versions as a fourth number. However there are a projects which use such build numbers and I assume some also use Maven. Not sure about CI-friendly versions so far. Without further thinking I'm okay to this (My team also only use three segments), but I would at least add a link to the naming convention to the exception. And even then: It's a convention - not a fixed rule, which it becomes with this check, right? -- 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