All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.outbrain.ci.friendly.flatten.maven.plugin.VersionUtil Maven / Gradle / Ivy

Go to download

Plugin helps to use CI friendly versions in maven projects by simplifying the flatten-maven-plugin

There is a newer version: 1.0.27
Show newest version
package com.outbrain.ci.friendly.flatten.maven.plugin;

import org.apache.maven.plugin.MojoExecutionException;

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

public class VersionUtil {

  public static String getVersion(final String prefixedVersion, final String prefixRegex) throws MojoExecutionException {
    final String regex = prefixRegex + "(.+)";
    final Matcher matcher = Pattern.compile(regex).matcher(prefixedVersion);
    if (!matcher.find()) {
      throw new MojoExecutionException("Cannot extract version from " + prefixedVersion + " with prefix regex " + prefixRegex);
    }
    return matcher.group(1);
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy