Closed Pralhadb closed 7 years ago
In setting.gradle, I did:
buildscript{ repositories { maven { } }
}
dependencies{
classpath 'gradle.plugin.net.vivin:gradle-semantic-build-versioning:3.0.4'
}
} apply plugin: 'net.vivin.gradle-semantic-build-versioning'
also, added: semantic-build-versioning.gradle which conteins:
also, added: semantic-build-versioning.gradle which conteins:
autobump {
majorPattern = ~/(?m)^\[bump-major\]$/
minorPattern = ~/(?m)^\[bump-minor\]$/
patchPattern = ~/(?m)^\[bump-patch\]$/
newPreReleasePattern = ~/(?m)^\[make-new-pre-release\]$/
promoteToReleasePattern = ~/(?m)^\[promote-to-release\]$/
}
Could you please help me out with this issue, that it is not working with promote-to-release.
What error message did you get?
Hi Vivin,
Thanks for your response.
When I am doing any changes and trying to commit with "Promote-to-release", on build of printversion it fails saying some error like creating promote to release is not possible.......
Example, I am trying on version 2.1.1-SNAPSHOT, it should be 2.1.1 after build of printversion , but it fails.
Hi Vivin,
Should I need to do any changes or it is possible to fix from your end. The actual error message is as follows:
$ gradlew printversion
FAILURE: Build failed with an exception.
What went wrong: Creating a new pre-release while also promoting a pre-release is not supported
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
$ gradlew printversion --stacktrace
FAILURE: Build failed with an exception.
What went wrong: Creating a new pre-release while also promoting a pre-release is not supported
Try: Run with --info or --debug option to get more log output.
Exception is: org.gradle.tooling.BuildException: Creating a new pre-release while also promoti ng a pre-release is not supported at net.vivin.gradle.versioning.VersionUtils.determineVersion(VersionUtil s.groovy:62) at net.vivin.gradle.versioning.VersionUtils$determineVersion.call(Unknow n Source) at net.vivin.gradle.versioning.SemanticBuildVersion.toString(SemanticBui ldVersion.groovy:157) at net.vivin.gradle.versioning.SemanticBuildVersioningPlugin$_apply_clos ure1.doCall(SemanticBuildVersioningPlugin.groovy:40) at org.gradle.api.internal.ClosureBackedAction.execute(ClosureBackedActi on.java:67) at org.gradle.api.internal.project.AbstractProject.configure(AbstractPro ject.java:472) at org.gradle.api.internal.project.AbstractProject.allprojects(AbstractP roject.java:467) at org.gradle.invocation.DefaultGradle$2.execute(DefaultGradle.java:126)
at org.gradle.invocation.DefaultGradle$2.execute(DefaultGradle.java:124)
at org.gradle.listener.ActionBroadcast.execute(ActionBroadcast.java:39)
at org.gradle.invocation.DefaultGradle$1.projectsLoaded(DefaultGradle.ja
va:72) at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionD ispatch.java:35) at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionD ispatch.java:24) at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(Abstract BroadcastDispatch.java:44) at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatc h.java:79) at org.gradle.internal.event.BroadcastDispatch.dispatch(BroadcastDispatc h.java:30) at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocat ionHandler.invoke(ProxyDispatchAdapter.java:93) at com.sun.proxy.$Proxy10.projectsLoaded(Unknown Source) at org.gradle.initialization.NotifyingSettingsLoader.findAndLoadSettings (NotifyingSettingsLoader.java:36) at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(Default GradleLauncher.java:119) at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGra dleLauncher.java:32) at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradl eLauncher.java:99) at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradl eLauncher.java:93) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(Defaul tBuildOperationExecutor.java:90) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(Defaul tBuildOperationExecutor.java:62) at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradle Launcher.java:93) at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLaun cher.java:82) at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildCon troller.run(InProcessBuildActionExecuter.java:94) at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(Exe cuteBuildActionRunner.java:28) at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildA ctionRunner.java:35) at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProce ssBuildActionExecuter.java:43) at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProce ssBuildActionExecuter.java:28) at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(Contin uousBuildActionExecuter.java:77) at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(Contin uousBuildActionExecuter.java:47) at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.exe cute(DaemonUsageSuggestingBuildActionExecuter.java:51) at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.exe cute(DaemonUsageSuggestingBuildActionExecuter.java:28) at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:43) at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.jav a:170) at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction. execute(CommandLineActionFactory.java:237) at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction. execute(CommandLineActionFactory.java:210) at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRunti meValidationAction.java:35) at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRunti meValidationAction.java:24) at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute( CommandLineActionFactory.java:206) at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute( CommandLineActionFactory.java:169) at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionRep ortingAction.java:33) at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionRep ortingAction.java:22) at org.gradle.launcher.Main.doAction(Main.java:33) at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45) at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBoots trap.java:54) at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.j ava:35) at org.gradle.launcher.GradleMain.main(GradleMain.java:23) at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.ja va:30) at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:129) at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
BUILD FAILED
Total time: 8.643 secs
kindly look into above error details and please let me know solution for this.
i am trying for the requirement is to create release version from Snapshot version. Ex: current version: 2.1.1-SNAPSHOT new version should be release one. that is: 2.1.1
please provide your help.
So your commit message contains [promote-to-release]
or something similar?
You can only promote pre-release versions to release versions. The documentation explains this. I suspect you're simply trying to create a release version (i.e., one without the snapshot suffix). For that, you only need to supply -Prelease
.
By default, if it doesn't find any matching commit-messages, it will bump the version with the least-precedence, which is the patch version unless the latest version is a pre-release version, in which case it will bump that according to the bumping scheme that you have defined.
hi, I tried with the commit message which contains [promote-to-release] .
For that, I only need to supply -Prelease. that means , I need to do this change in : newPreReleasePattern = ~/(?m)^[make-new-pre-release]$/ here to PreReleasePattern = ~/(?m)^[prerelease]$/ like this.
OR i need to give commit message as [Prelease]
I tried with snapshot suffix only. but, still it shows above error.
You cannot use [promote-to-release]
because that only works if the previous version is a pre-release version. What you're trying to do is create a new release version (i.e., one that is not a snapshot) with the patch-version bumped. For that, your commit message needs to contain a pattern that tells it to do that; [patch]
is the default, I believe. So you will need to amend your commit message and use [patch]
instead (or whatever pattern you have configured to bump the patch version).
If you do this, gradle printVersion
will show 2.1.1-SNAPSHOT
. If you want to create a non-snapshot version, you need to supply -Prelease
; gradle printVersion -Prelease
will then show 2.1.1
.
Note: As I mentioned earlier, that is not strictly necessary since by default even if there are no matching commit messages, the plugin will bump the version with the lowest-precedence.
@Pralhadb Were you able to fix the issue?
hi vivin,
I tried with the option which you suggested: gradlew printversion -Prelease it gives release version by removing the identifier- SNAPSHOT. But, we need to do it automatically in the same way how works for major & minor i.e., by commit message.
as per your suggestion, I tried as below: if current version is 1.1.2, on commit message= [bump-patch], it gives 1.1.3-SNAPSHOT. if 1) On this version commit = [promote-to-release], it gives error as "Bumping any component while also promoting a pre-release is not supported"
or 2) commit =[make-new-pre-release] , it gives error as "Cannot create a new pre-release if pre-release configuration is not specified. "
also, trying to add some changes in 'semantic-build-versioning.gradle':
preRelease {
startingVersion = '0.1.0-alpha.0'
// The bumping scheme is alpha.0 -> alpha.1 -> ... -> alpha.n
bump = {
"alpha.${((it - ~/^alpha\./) as int) + 1}"
}
}
kindly tell me what is the correction i need to do or any changes i have to do.
Well, the ability to mark it as a release via commit message isn't really supported; is there a reason that you cannot use -Prelease
? Are you also deploying snapshot versions? Couldn't pre-release versions be used for that?
It seems strange that you would get the "pre-release configuration is not specified" when you have the pre-release configuration. I don't see why this could be it, but I notice that your starting pre-release identifier is in the wrong format; you only need to provide alpha.0
.
You cannot mix and match certain bump directives; I believe it is called out in the documentation.
You cannot promote to release while also bumping a component. You will have to amend your commit to remove that pattern.
The issue seems to be that you have multiple commits since the last tag, which seem to be mixing together making a new pre release, promoting a pre release, bumping a pre release, and bumping some other component.
hi vivin,
Isn't there any option which will promote the snapshot version to release version directly and automatically? I might wrong to get the criteria for promoting the pre-release.
i am working on the same task which user- @darlenya discussed with you.
@Pralhadb
Well, it really depends on your CI process. Are you actually deploying snapshot versions? What criteria do you currently use to determine whether you should be deploying snapshot versions or a non-snapshot version?
@Pralhadb were you able to figure this out?
Hi Vivin, in our ci Process we have no suffix as RELASE or SNAPSHOT at all. We are doing semantic release as it is usual for Java Script versioning in NPM. So we would like to deploy (on the test system) every version.
@darlenya So in your CI process I assume you just explicitly set -Prelease?
.
It's not clear to me how to solve @Pralhadb's issue because I'm not sure how his CI process works.
No, we did not set anything explicitly. The idea was to deploy every commit (ONLY the excepted pull requests) as a real version. So all the suffixes as "prerelease" or "release" are not needed. And every one should aged and published. Thats how the CI process works. And we did not find out how to directly tag a fix as a new release. As a fix always contains the suffix 'prerelease'.
Closing this issue due to lack of information.
Hi,
I did the required changes suggested by you and have implemented the plugin successfully. It is working fine with Major, Minor and Patch version. But, I am facing issues while promoting the version from pre-release. It is giving error with "promote-to-release" commit. Could you please help me out with this.