Partial implementation of Spring Boot Releases

This commit is contained in:
Nieraj Singh
2022-11-12 03:56:54 -08:00
parent 1a262f2a3f
commit db472bf04e
9 changed files with 94 additions and 30 deletions

View File

@@ -186,4 +186,22 @@ public class SpringProjectUtil {
}
return null;
}
public static Version getVersion(String version) {
Pattern pattern = Pattern.compile(VERSION_PATTERN_STR);
Matcher matcher = pattern.matcher(version);
if (matcher.find() && matcher.groupCount() > 4) {
String major = matcher.group(1);
String minor = matcher.group(2);
String patch = matcher.group(3);
String qualifier = matcher.group(5);
return new Version(
Integer.parseInt(major),
Integer.parseInt(minor),
Integer.parseInt(patch),
qualifier
);
}
return null;
}
}