private static String nextVersion()

in src/main/java/org/apache/openejb/tools/release/cmd/AddVersion.java [127:159]


    private static String nextVersion(final String systemProperty, final String version, final boolean fromSnapshot, final boolean toSnapshot) {
        if (fromSnapshot) { // we want to replace version-SNAPSHOT by version so keep it
            return version;
        }

        // if we forced the next version
        final String next = System.getProperty(systemProperty + ".next");
        if (next != null) {
            return next;
        }

        // we want to increment the last digit
        String newVersion = null;

        final Matcher betaMatcher = BETA_PATTERN.matcher(version);
        if (betaMatcher.matches()) {
            newVersion = replace(version, betaMatcher.group(1));
        }

        final Matcher mavenMatcher = MAVEN_VERSION_PATTERN.matcher(version);
        if (newVersion == null && mavenMatcher.matches()) {
            newVersion = replace(version, mavenMatcher.group(1));
        }

        if (newVersion == null) {
            throw new IllegalArgumentException("can't manage the version " + version);
        }

        if (toSnapshot) {
            return newVersion + SNAPSHOT_SUFFIX;
        }
        return newVersion;
    }