
com.outbrain.ci.friendly.flatten.maven.plugin.VersionUtil Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ci-friendly-flatten-maven-plugin Show documentation
Show all versions of ci-friendly-flatten-maven-plugin Show documentation
Plugin helps to use CI friendly versions in maven projects by simplifying the flatten-maven-plugin
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