diff --git a/src/main/java/com/amashchenko/maven/plugin/gitflow/GitFlowVersionInfo.java b/src/main/java/com/amashchenko/maven/plugin/gitflow/GitFlowVersionInfo.java
index 07cd34e6..a5234721 100644
--- a/src/main/java/com/amashchenko/maven/plugin/gitflow/GitFlowVersionInfo.java
+++ b/src/main/java/com/amashchenko/maven/plugin/gitflow/GitFlowVersionInfo.java
@@ -28,10 +28,10 @@
/**
* Git flow {@link org.apache.maven.shared.release.versions.VersionInfo}
* implementation. Adds few convenient methods.
- *
+ *
*/
public class GitFlowVersionInfo extends DefaultVersionInfo {
-
+
private final VersionPolicy versionPolicy;
public GitFlowVersionInfo(final String version, final VersionPolicy versionPolicy)
@@ -42,7 +42,7 @@ public GitFlowVersionInfo(final String version, final VersionPolicy versionPolic
/**
* Returns a new GitFlowVersionInfo that holds only digits in the version.
- *
+ *
* @return Digits only GitFlowVersionInfo instance.
* @throws VersionParseException
* If version parsing fails.
@@ -53,7 +53,7 @@ public GitFlowVersionInfo digitsVersionInfo() throws VersionParseException {
/**
* Validates version.
- *
+ *
* @param version
* Version to validate.
* @return true when version is valid, false
@@ -80,7 +80,7 @@ public String getReleaseVersionString() {
/**
* Gets next SNAPSHOT version.
- *
+ *
* @return Next SNAPSHOT version.
*/
public String nextSnapshotVersion() {
@@ -89,7 +89,7 @@ public String nextSnapshotVersion() {
/**
* Gets next SNAPSHOT version.
- *
+ *
* @param index
* Which part of version to increment.
* @return Next SNAPSHOT version.
@@ -101,7 +101,7 @@ public String nextSnapshotVersion(final Integer index) {
/**
* Gets next version. If index is null or not valid then it
* delegates to {@link #getNextVersion()} method.
- *
+ *
* @param index
* Which part of version to increment.
* @param snapshot
@@ -147,7 +147,7 @@ private String nextVersion(final Integer index, boolean snapshot) {
/**
* Gets version with appended feature name.
- *
+ *
* @param featureName
* Feature name to append.
* @return Version with appended feature name.
@@ -155,15 +155,20 @@ private String nextVersion(final Integer index, boolean snapshot) {
public String featureVersion(final String featureName) {
String version = toString();
if (featureName != null) {
- version = getReleaseVersionString() + "-" + featureName
+ version = getReleaseVersionString() + "-" + getCleanedFeatureName(featureName)
+ (isSnapshot() ? "-" + Artifact.SNAPSHOT_VERSION : "");
}
return version;
}
+ public static String getCleanedFeatureName(String featureName) {
+ String cleanedFeatureName = featureName.replaceAll("[\\\\/:\"<>|?*]", "-");
+ return cleanedFeatureName.replaceAll("-+", "-");
+ }
+
/**
* Gets next hotfix version.
- *
+ *
* @param preserveSnapshot
* Whether to preserve SNAPSHOT in the version.
* @param index