diff --git a/src/integTest/groovy/nebula/plugin/release/ReleasePluginIntegrationSpec.groovy b/src/integTest/groovy/nebula/plugin/release/ReleasePluginIntegrationSpec.groovy index 51b9858..6631fcd 100644 --- a/src/integTest/groovy/nebula/plugin/release/ReleasePluginIntegrationSpec.groovy +++ b/src/integTest/groovy/nebula/plugin/release/ReleasePluginIntegrationSpec.groovy @@ -626,7 +626,7 @@ class ReleasePluginIntegrationSpec extends GitVersioningIntegrationSpec { def result = runTasksWithFailure('final', '-Prelease.useLastTag=true') then: - result.standardError.contains "Current tag does not appear to be a final version" + result.standardError.contains "Current tag (3.1.2-rc.1) does not appear to be a final version" !new File(projectDir, "build/libs/${moduleName}-3.1.2-rc.1.jar").exists() } @@ -650,7 +650,7 @@ class ReleasePluginIntegrationSpec extends GitVersioningIntegrationSpec { def result = runTasksWithFailure('candidate', '-Prelease.useLastTag=true') then: - result.standardError.contains "Current tag does not appear to be a prerelease version" + result.standardError.contains "Current tag (3.1.2) does not appear to be a pre-release version. A pre-release version MAY be denoted by appending a hyphen and a series of dot separated identifiers immediately following the patch version. For more information, please refer to https://semver.org/" !new File(projectDir, "build/libs/${moduleName}-3.1.2-rc.1.jar").exists() !new File(projectDir, "build/libs/${moduleName}-3.1.2.jar").exists() } @@ -815,7 +815,7 @@ class ReleasePluginIntegrationSpec extends GitVersioningIntegrationSpec { def result = runTasksWithFailure('candidate', '-Prelease.useLastTag=true') then: - result.standardError.contains "Current tag does not appear to be a prerelease version" + result.standardError.contains "Current tag (3.1.2) does not appear to be a pre-release version. A pre-release version MAY be denoted by appending a hyphen and a series of dot separated identifiers immediately following the patch version. For more information, please refer to https://semver.org/" !new File(projectDir, "build/libs/${moduleName}-3.1.2.jar").exists() } @@ -988,7 +988,7 @@ class ReleasePluginIntegrationSpec extends GitVersioningIntegrationSpec { def result = runTasksWithFailure('final', '-Prelease.useLastTag=true') then: - result.standardError.contains 'Current tag does not appear to be a final version' + result.standardError.contains 'Current tag (3.1.2-release2) does not appear to be a final version' } diff --git a/src/main/groovy/nebula/plugin/release/OverrideStrategies.groovy b/src/main/groovy/nebula/plugin/release/OverrideStrategies.groovy index 8a5cbae..305742f 100644 --- a/src/main/groovy/nebula/plugin/release/OverrideStrategies.groovy +++ b/src/main/groovy/nebula/plugin/release/OverrideStrategies.groovy @@ -15,6 +15,7 @@ */ package nebula.plugin.release +import com.github.zafarkhaja.semver.Version import nebula.plugin.release.git.base.ReleasePluginExtension import nebula.plugin.release.git.base.ReleaseVersion import nebula.plugin.release.git.base.VersionStrategy @@ -85,15 +86,16 @@ class OverrideStrategies { throw new GradleException("Current commit has a snapshot, immutableSnapshot or devSnapshot tag. 'useLastTag' requires a prerelease or final tag.") } - def preReleaseVersion = locate.any.preReleaseVersion + Version version = locate.any + def preReleaseVersion = version.preReleaseVersion if (releaseStage == 'rc') { if (!(preReleaseVersion ==~ /rc\.\d+/)) { - throw new GradleException("Current tag does not appear to be a prerelease version") + throw new GradleException("Current tag ($version) does not appear to be a pre-release version. A pre-release version MAY be denoted by appending a hyphen and a series of dot separated identifiers immediately following the patch version. For more information, please refer to https://semver.org/") } } if (releaseStage == 'final') { if (preReleaseVersion) { - throw new GradleException("Current tag does not appear to be a final version") + throw new GradleException("Current tag ($version) does not appear to be a final version. final task can not be used with prerelease versions. A pre-release version MAY be denoted by appending a hyphen and a series of dot separated identifiers immediately following the patch version. For more information, please refer to https://semver.org/") } }