package nu.studer.teamcity.buildscan.agent;

import org.jetbrains.annotations.Nullable;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public final class MavenVersionUtils {

    private static final Pattern VERSION_OUTPUT_REGEX = Pattern.compile("Apache Maven\\s+(.*)\\s+\\(.*\\)");

    @Nullable
    public static String parseVersion(String output) {
        Matcher matcher = VERSION_OUTPUT_REGEX.matcher(output);
        return matcher.find() ? matcher.group(1) : null;
    }

    public static boolean isVersionAtLeast(String version, String requiredVersion) {
        if (isNullOrEmpty(version) || isNullOrEmpty(requiredVersion)) {
            return false;
        }

        String[] versionParts = version.split("-")[0].split("\\.");
        String[] requiredVersionParts = requiredVersion.split("-")[0].split("\\.");
        for (int i = 0; i < versionParts.length; i++) {
            if (i >= requiredVersionParts.length) {
                return false;
            }
            int versionPart = Integer.parseInt(versionParts[i]);
            int requiredVersionPart = Integer.parseInt(requiredVersionParts[i]);
            if (versionPart != requiredVersionPart) {
                return versionPart > requiredVersionPart;
            }
        }
        return true;
    }

    private static boolean isNullOrEmpty(String str) {
        return str == null || str.trim().isEmpty();
    }

    private MavenVersionUtils() {
    }

}

@@ -147,23 +147,89 @@
 ttern;%0A%0A
-public 
+/**%0A * Provides utilities related to version parsing and comparison.%0A */%0A
 final cl

Make class package-scoped