Skip to content

Commit

Permalink
Latest release now resolves plugin:5.x
Browse files Browse the repository at this point in the history
  • Loading branch information
timtebeek committed Oct 10, 2024
1 parent f1e0a4f commit ba20bd0
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,15 @@ class Example {
record Versions(String parentVersion, String propertyVersion, String bomArtifactId, String bomVersion) {
static Versions parse(String pomXml) {
return new Versions(
firstGroupFromFirstRegexMatch(" <version>(4\\.[^<]+)", pomXml),
firstGroupFromFirstRegexMatch(" <version>(5\\.[^<]+)", pomXml),
firstGroupFromFirstRegexMatch("<jenkins.version>([^<]+)", pomXml),
firstGroupFromFirstRegexMatch("<artifactId>(bom-[^<]+)", pomXml),
firstGroupFromFirstRegexMatch(" <version>([^<]+)", pomXml)
);
}

private static String firstGroupFromFirstRegexMatch(String regex, String pomXml) {
return Pattern.compile(regex).matcher(pomXml).results().findFirst().orElseThrow().group(1);
return Pattern.compile(regex).matcher(pomXml).results().findFirst().orElseThrow(() -> new IllegalStateException(pomXml)).group(1);
}

@Language("XML") String asPomXml() {
Expand Down

0 comments on commit ba20bd0

Please sign in to comment.