public static MavenVersion parse(String version) throws ParseException {
        version = version.trim();
        if (version.isEmpty()) {
            throw new ParseException("Empty string", 0);
        }
        String[] dotSplit = version.split("\\.");
        if (dotSplit.length > 3) {
            throw new ParseException("A maven version cannot contain more than 2 dots (.)", -1);
        }
        if (dotSplit.length == 0) { // No dots
            dotSplit = new String[]{version};
        }
        boolean snapshot = false;
        String majorVersion = "";
        String featureVersion = null;
        String bugfixVersion = null;
        for (int i = 0; i < dotSplit.length; i++) {
            String string = dotSplit[i];
            // System.out.println(i + " " + string);
            if (i + 1 == dotSplit.length) {
                // We need to check for snapshot on the last split, - is allowed before this
                if (string.toLowerCase().endsWith(SNAPSHOT)) {
                    snapshot = true;
                    string = string.substring(0, string.length() - SNAPSHOT.length());
                }
            }
            if (i == 0) {
                majorVersion = string;
            }
            if (i == 1) {
                featureVersion = string;
            }
            if (i == 2) {
                bugfixVersion = string;
            }
        }
        return new MavenVersion(majorVersion, featureVersion, bugfixVersion, snapshot);
    }