Giter VIP home page Giter VIP logo

gradle-semantic-build-versioning's People

Contributors

vampire avatar vivin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gradle-semantic-build-versioning's Issues

`autobump` doesn't aggregate version changes from commit messages

This is probably not an issue, but I thought I'd log it as one just to be sure:

I've implemented the autobump custom commit message scheme as you described the original example in the documentation; i.e.:

autobump {
majorPattern = ~/(?m)^[bump-major]$/ # match "[bump-major]" on its own line without leading or trailing characters
minorPattern = ~/(?m)^[bump-minor]$/ # match "[bump-minor]" on its own line without leading or trailing characters
patchPattern = ~/(?m)^[bump-patch]$/ # match "[bump-patch]" on its own line without leading or trailing characters
newPreReleasePattern = ~/(?m)^[make-new-pre-release]$/ # match "[make-new-pre-release]" on its own line without leading or trailing characters
promoteToReleasePattern = ~/(?m)^[promote-to-release]$/ # match "[promote-to-release]" on its own line without leading or trailing characters
}

I updated the semantic-build-versioning.gradle file with the above configuration and checked it in with [bump-minor] in the commit message on a separate line. At that point in the repo, the last tag was 0.2.0 which was some commits previous, and all branches and pointers were up-to-date on the latest commit. When I did a clean build the build broke given the # characters aren't recognized as comments in Groovy (doh!) so I had to replace them with the appropriate // characters. Once I did that all was well, and sure enough a clean build gave me a version of 0.3.0 as expected.

I then had to check in the updated version of the semantic-build-versioning.gradle file with the appropriate comment changes, and I used the [bump-patch] string in the comment (on a separate line of course, no leading/trailing spaces). When I did a clean build I expected a version of 0.3.1, but got 0.3.0 instead. Now I realize that the minor bump has higher precedence than the patch bump, but I would have expected that both (all) bump comment strings would have been aggregated since the last tag and would have moved the version accordingly. Is that not how it's supposed to work?

Many thanks again for your time and patience! :)

Adding the plugin to an existing gradle project

  • Failed to apply plugin [id 'net.vivin.gradle-semantic-build-versioning']

    org.gradle.api.internal.project.DefaultProject_Decorated cannot be cast to org.gradle.api.initialization.Settings


logs:
Caused by: org.gradle.api.internal.plugins.PluginApplicationException: Failed to apply plugin [id 'net.vivin.gradle-semantic-build-versioning']
at org.gradle.api.internal.plugins.DefaultPluginManager.doApply(DefaultPluginManager.java:156)
at org.gradle.api.internal.plugins.DefaultPluginManager.apply(DefaultPluginManager.java:113)
at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.applyType(DefaultObjectConfigurationAction.java:113)
at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.access$200(DefaultObjectConfigurationAction.java:36)
at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction$3.run(DefaultObjectConfigurationAction.java:80)
at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.execute(DefaultObjectConfigurationAction.java:136)
at org.gradle.api.internal.project.AbstractPluginAware.apply(AbstractPluginAware.java:44)
at org.gradle.api.internal.project.ProjectScript.apply(ProjectScript.java:34)
at org.gradle.api.Script$apply.callCurrent(Unknown Source)
at build_ow8z3b7o1ol9633aj9ki9csm.run(D:\swa-parts-transfer\build.gradle:3)
at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:90)
... 62 more
Caused by: java.lang.ClassCastException: org.gradle.api.internal.project.DefaultProject_Decorated cannot be cast to org.gradle.api.initialization.Settings
at net.vivin.gradle.versioning.SemanticBuildVersioningPlugin.apply(SemanticBuildVersioningPlugin.groovy)
at org.gradle.api.internal.plugins.ImperativeOnlyPluginApplicator.applyImperative(ImperativeOnlyPluginApplicator.java:35)
at org.gradle.api.internal.plugins.RuleBasedPluginApplicator.applyImperative(RuleBasedPluginApplicator.java:43)
at org.gradle.api.internal.plugins.DefaultPluginManager.doApply(DefaultPluginManager.java:140)

Can't find latest version 3.0.0

I've followed the instructions in the latest README.md file and I still get this error. Is the plugin artifact not yet published to the gradle repository?

  • What went wrong:
    Could not resolve all dependencies for configuration 'classpath'.

Could not find gradle.plugin.net.vivin:gradle-semantic-build-versioning:3.0.0.
Searched in the following locations:
https://plugins.gradle.org/m2/gradle/plugin/net/vivin/gradle-semantic-build-versioning/3.0.0/gradle-semantic-build-versioning-3.0.0.pom
https://plugins.gradle.org/m2/gradle/plugin/net/vivin/gradle-semantic-build-versioning/3.0.0/gradle-semantic-build-versioning-3.0.0.jar
Required by:
unspecified:unspecified:unspecified

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

allow calculating the version based on number of commit since closest ancestor tag

i would like for every CI build on my project to create a non-snapshot release.

IIUC, that currently means creating a tag on every single commit which (no matter if done manually or by the plugin) seems combersome to me.

i'd like to propose the option of calculating the version string as "version from latest tag" + [number of commits since tag] (as patch version)

so if i have commit hash H1 with tag 1.2.3, commit H2 would be 1.2.4, H3 would be 1.2.5 etc until a new tag is created (to mark the next major/minor release)

bumpMajor task is always skipped

Hi,

We are trying to use the plugin but face issues to have the bumpMajor task increase the version.
We have a git tag which is correctly picked up by printVersion task but nevertheless bumpMajor is always skipped because there are no actions. Can you help? (we ran out of ideas).

Thanks a lot,
Alin

Injecting the branch name into preRelease version

Hi,

I'm trying to get your plugin into my project and we have the requirement to append the branch name into our version. The reason is that we develop multiple features simultaneously on different branches. We have the need to deploy them individually without conflicting versions.

Since the plugin changed to the configuration approach I can not execute e.g. grgit in semantic-build-versioning.properties file.

Did I miss something, or is this not possible at all?

Thanks for your help and the great work on this plugin.

Best

Not able to refresh the gradle project with this plugin

Please find the gradle file.

buildscript {
ext { springBootVersion = '1.4.1.RELEASE' }
repositories { mavenCentral()
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}}
dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath 'gradle.plugin.net.vivin:gradle-semantic-build-versioning:4.0.0'

}

}

group 'net.vivin'
apply plugin: 'eclipse'
apply plugin: 'spring-boot'
apply plugin: 'application'
apply plugin: 'net.vivin.gradle-semantic-build-versioning'

mainClassName = "sem.Semver"

jar {
baseName = 'demo'
//version = '0.0.1-SNAPSHOT'
//version=versioning.info.full
}

repositories { mavenCentral() }

configurations { providedRuntime }
configurations.all{
exclude group:'javax.servlet', module :'servlet-api'
}

task wrapper(type: Wrapper) {
gradleVersion = '2.9'
}

Getting the following error

FAILURE: Build failed with an exception.

  • Where:
    Build file '/home/user/testgit/Semver/build.gradle' line: 23

  • What went wrong:
    A problem occurred evaluating root project 'Semver'.

Failed to apply plugin [id 'net.vivin.gradle-semantic-build-versioning']
org.gradle.api.internal.project.DefaultProject_Decorated cannot be cast to org.gradle.api.initialization.Settings

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 0.501 secs

Can one reset the back to the startingVersion?

For example in build.gradle:
project.version.with {
startingVersion = '1.0.0'
}

Then to test out how things work one runs:

  1. ./gradlew release
  2. ./gradlew build -x test
    Results in a 1.0.0 release jar with the next version being 1.0.1-SNAPSHOT (which makes sense).

But now I want to reset everything and build 1.0.0-SNAPSHOT when I run ./gradlew build -x test. Is that possible?

SNAPSHOT is not being suffixed

Hi,

When i'm using the bumpMinor, i face the issue that the Version that we create should by deafult be bumped to the latest with a _SNAPSHOT suffix.

But the same doesnt work as expected. For some reason the logic of your plugin breaks and doesn't suffx appropriately

How can we know for sure that it does the versioning seamlessly.

Allow multiple Tags on the same commit

Hi,

currently we build a new release version with every build that Jenkins does. This causes the problem that we might want to do another build that starts with a different configuration. But this second build is built on the same commit.
The versioning plugin then refuses to do that because it can not create a tag since the commit is already tagged.

Is it possible to allow this? Since the plugin should be able to resolve which tag is the latest on one commit it should be able to determine a proper version.

JGit dependency causes false positive when testing for uncommited files with git LFS

Hi,

I spend the whole week hunting a strange behavior on our build server which was caused by this plugin when it checked if the current git state had uncommited changes in VersionUtils.hasUncomittedChanges().

I didn't understand why exactly there was a false positive but I assume that the JGit library has a bug when using it together with git lfs (which we do). I come to this conclusion because all files that JGit complained about where binary files managed by git lfs.

The solution is rather simple to fix this problem by simply updating the library to 4.8.0.201706111038-r. I already did this for our project but I would like to still use your published dependency that's why I ask If you could update the library and release a new version of this plugin.

Best,

Need annotated tag for Gerrit

Hi,

We want to use this plugin for our project* but we are using(forced by the company :P) Gerrit, and it allows only annotated tags to be pushed to it.

I'm thinking that there should be a way of determining automatically whether or not the tag should be annotated based on the configuration. If the user has defined the message to be used for annotated tags then the tag should be created as annotated=true, and false otherwise. However, I don't know what would be the best way to do it :)

Would it be possible to add this?

*(the project is quite large and will be used by many people(>500), it would be great if we could use something that already exists instead of having to create something ourselves)

Weird behavior invoking printVersion

Hello, i'm using your gradle plugin in a project with Circle CI 2.0 integration and I'm getting weird results.

First of all, I've a problem with ssh connection and task tag --push. Git works but the plugin doesn't. I've the ssh private key added to ssh keystore.

#!/bin/bash -eo pipefail
./gradlew tag -Prelease --push
Picked up _JAVA_OPTIONS: -Xms512m -Xmx2048m
:tag FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':tag'.
> org.eclipse.jgit.api.errors.TransportException: [email protected]:repositoryName.git: push not permitted

So, I've changed the task invokation to

./gradlew -Prelease printVersion -q | awk '{print "v"$1}' | xargs git tag
git push origin --tags

And I get:

#!/bin/bash -eo pipefail
./gradlew -Prelease printVersion -q | awk '{print "v"$1}'
Picked up _JAVA_OPTIONS: -Xms512m -Xmx2048m
vCleaned
vCleaned
vCleaned
vCleaned
v1.0.1

So i've change to:

./gradlew -Prelease printVersion -q | awk '{print "v"$1}' | xargs -n 1 git tag
git push origin --tags

To get the last message, the version number.

Do you know why i'm getting those "Cleaned" messages?

Thanks !!

Could not autobump because the last commit message did not match the major

Hi,

I am new to grade and trying to make use of this plugin. When using " project.version.with { startingVersion = '1.0.2' }" it works charm 👍 But struggling to get the autobump working. I tried with the commit messages - majorPattern=[1], minorPattern=[1], patchPattern=[0]
It keeps complaining "Could not autobump because the last commit message did not match the major (/^[major]$/), minor (/^[minor]$/), patch (/^[patch]$/), pre-release (/^[pre-release]$/), or release (/^[promote]$/) patterns specified in the auto bump configuration"

Below is my configuration,
autobump {
majorPattern =~ /^[bump-major]$/
minorPattern =~ /^[bump-minor]$/
patchPattern =~ /^[bump-patch]$/
}
Please can you advice with an example commit message? Sorry to raise this as an issue as I can't find any forum to discuss this.

Option to force a new tag on the same commit which is already tagged

My use case: We are working in sprints and have 10-ish projects that are developed in parallel and work together and we are using this plugin to handle the versioning of our projects, basically tagging the project with a sprint number.

Now for the projects that don't change during a sprint, I want to be able to still tag them. So I can check out later on, all projects using the same tag version, and I can be sure that the code can work together.

Would it be possible to add a new flag that allows me to force a tag on a commit that allready is tagged?

Cheers

Tagging of project with sub-project fails

I have a Git project that contains sub-projects. If I try to tag it (with gradlew tag -Prelease -PbumpComponent=minor) I get the error message "Cannot create a release version when there are uncommitted changes". But the project is unchanged, git status yields "Your branch is up to date with 'origin/master'. nothing to commit, working tree clean".

The Gradle stacktrace:

org.gradle.tooling.BuildException: Cannot create a release version when there are uncommitted changes                               
        at net.vivin.gradle.versioning.VersionUtils.determineVersion(VersionUtils.groovy:82)                                        
        at net.vivin.gradle.versioning.VersionUtils$determineVersion.call(Unknown Source)                                           
        at net.vivin.gradle.versioning.SemanticBuildVersion.toString(SemanticBuildVersion.groovy:157)                               
        at net.vivin.gradle.versioning.SemanticBuildVersioningPlugin$_apply_closure1.doCall(SemanticBuildVersioningPlugin.groovy:40)

Tagging considers the previous tags only on current branch and not complete git tree

While running the tag task, it considers (for filtering) the tags only on current branch. I have two branches on my project. Both have the same gradle and plugin settings.
Tags on branch-1: v0.1.0-alpha.1, v0.1.0-alpha.2, v0.1.0-alpha.3
Then created branch-2 and someone else worked there.
Tags on branch-2: v0.1.0-alpha.4, v0.1.0-alpha.5

Now when I do gradle tag on branch-1 it throws an error that v0.1.0-alpha.4 already exists while it should tag it with v0.1.0-alpha.6

Build failed while generating version for my project jar

Hi ,

I am trying to use version plugin and getting error when using following command

gradlew clean jar bumpMinor --stacktrace

gradlew clean jar autobump --stacktrace

I am getting below error

  • What went wrong:
    Could not add entry ':buildProperties' to cache taskArtifacts.bin (.gradle\2.9\taskArtifacts\taskArtifacts.bin).

Unable to store task input properties. Property 'info.app.version' with value '1.0.1-SNAPSHOT' cannot be serialized.

  • Exception is:
    org.gradle.api.UncheckedIOException: Could not add entry ':buildProperties' to cache taskArtifacts.bin (.gradle\2.9\taskArtifacts\taskArtifacts.bin).
    at org.gradle.cache.internal.btree.BTreePersistentIndexedCache.put(BTreePersistentIndexedCache.java:155)
    at org.gradle.cache.internal.DefaultMultiProcessSafePersistentIndexedCache$2.run(DefaultMultiProcessSafePersistentIndexedCache.java:51)
    at org.gradle.cache.internal.DefaultFileLockManager$DefaultFileLock.doWriteAction(DefaultFileLockManager.java:173)
    at org.gradle.cache.internal.DefaultFileLockManager$DefaultFileLock.writeFile(DefaultFileLockManager.java:163)
    at org.gradle.cache.internal.DefaultCacheAccess$UnitOfWorkFileAccess.writeFile(DefaultCacheAccess.java:404)
    at org.gradle.cache.internal.DefaultMultiProcessSafePersistentIndexedCache.put(DefaultMultiProcessSafePersistentIndexedCache.java:49)
    at org.gradle.api.internal.changedetection.state.CacheBackedTaskHistoryRepository$1$1.run(CacheBackedTaskHistoryRepository.java:91)
    at org.gradle.internal.Factories$1.create(Factories.java:22)
    at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:192)
    at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:175)
    at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirectoryStore.java:106)
    at org.gradle.cache.internal.DefaultCacheFactory$ReferenceTrackingCache.useCache(DefaultCacheFactory.java:187)
    at org.gradle.api.internal.changedetection.state.DefaultTaskArtifactStateCacheAccess.useCache(DefaultTaskArtifactStateCacheAccess.java:60)
    at org.gradle.api.internal.changedetection.state.CacheBackedTaskHistoryRepository$1.update(CacheBackedTaskHistoryRepository.java:66)
    at org.gradle.api.internal.changedetection.changes.DefaultTaskArtifactStateRepository$TaskArtifactStateImpl.afterTask(DefaultTaskArtifactStateRepository.java:124)
    at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:66)
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
    at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:203)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:185)
    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:66)
    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:50)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:25)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:110)
    at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
    at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23)
    at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43)
    at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30)
    at org.gradle.initialization.DefaultGradleLauncher$4.run(DefaultGradleLauncher.java:154)
    at org.gradle.internal.Factories$1.create(Factories.java:22)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:52)
    at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:151)
    at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:32)
    at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:99)
    at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:93)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:62)
    at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:93)
    at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:82)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:94)
    at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
    at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:43)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28)
    at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:77)
    at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:47)
    at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:51)
    at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:28)
    at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:43)
    at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java: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(JavaRuntimeValidationAction.java:35)
    at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.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(ExceptionReportingAction.java:33)
    at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.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(ProcessBootstrap.java:54)
    at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
    at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
    at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:30)
    at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:129)
    at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
    Caused by: org.gradle.api.GradleException: Unable to store task input properties. Property 'info.app.version' with value '1.0.1-SNAPSHOT' cannot be serialized.
    at org.gradle.api.internal.changedetection.state.InputPropertiesSerializer.write(InputPropertiesSerializer.java:42)
    at org.gradle.api.internal.changedetection.state.CacheBackedTaskHistoryRepository$LazyTaskExecution$TaskHistorySerializer.write(CacheBackedTaskHistoryRepository.java:310)
    at org.gradle.api.internal.changedetection.state.CacheBackedTaskHistoryRepository$TaskHistorySerializer.write(CacheBackedTaskHistoryRepository.java:171)
    at org.gradle.api.internal.changedetection.state.CacheBackedTaskHistoryRepository$TaskHistorySerializer.write(CacheBackedTaskHistoryRepository.java:146)
    at org.gradle.cache.internal.btree.BTreePersistentIndexedCache$DataBlock.setValue(BTreePersistentIndexedCache.java:654)
    at org.gradle.cache.internal.btree.BTreePersistentIndexedCache$DataBlock.(BTreePersistentIndexedCache.java:647)
    at org.gradle.cache.internal.btree.BTreePersistentIndexedCache.put(BTreePersistentIndexedCache.java:149)
    ... 72 more
    Caused by: org.gradle.internal.serialize.MapSerializer$EntrySerializationException: Unable to write entry with key: 'info.app.version' and value: '1.0.1-SNAPSHOT'.
    at org.gradle.internal.serialize.MapSerializer.write(MapSerializer.java:50)
    at org.gradle.api.internal.changedetection.state.InputPropertiesSerializer.write(InputPropertiesSerializer.java:40)
    ... 78 more
    Caused by: java.io.NotSerializableException: net.vivin.gradle.versioning.SemanticBuildVersion
    at org.gradle.internal.serialize.DefaultSerializer.write(DefaultSerializer.java:53)
    at org.gradle.internal.serialize.MapSerializer.write(MapSerializer.java:48)
    ... 79 more

My Git Tags are
git tag
1.0.0

build.gradle

buildscript {
ext {
grailsVersion = project.grailsVersion
}
repositories {
mavenLocal()
// maven { url "https://repo.grails.org/grails/core" }

    maven {
        credentials {
            username 'vishal'
            password 'London01'
        }
        url "https://sonarqube.qvmonarch.co.nz/nexus/repository/grails-plugins/"
    }

}
dependencies {
    classpath "org.grails:grails-gradle-plugin:$grailsVersion"
    classpath "com.bertramlabs.plugins:asset-pipeline-gradle:2.7.4"
    classpath "org.grails.plugins:hibernate4:5.0.4"
    classpath 'se.transmode.gradle:gradle-docker:1.2'
    classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.2"
}

}

plugins {
id "net.vivin.gradle-semantic-build-versioning" version "2.0.2"
}

plugins {
id "org.sonarqube" version "2.2"
}

group "propertyservice"

apply plugin:"eclipse"
apply plugin:"idea"

// Disable war plugin to create a jar file otherwise a fully executable war file is created.
apply plugin:"war"

apply plugin:"org.grails.grails-web"
apply plugin:"org.grails.grails-gsp"
apply plugin:"asset-pipeline"
apply plugin: 'docker'
// apply plugin:"codenarc"
apply plugin: "jacoco"
apply plugin: "org.sonarqube"
apply plugin: 'net.vivin.gradle-semantic-build-versioning'
project.version.with {
startingVersion = '1.0.0'
}

ext {
grailsVersion = project.grailsVersion
gradleWrapperVersion = project.gradleWrapperVersion
grails {
pathingJar = true
}
}

/*

  • Using repo.grails.org/grails/core Repository only for aws-sdk artifact
  • As while fetching aws-sdk from Nexus, even though after getting downloaded properly
  • It's not getting into application classpath and PropertyService is throwing compile time error.

  • NEED TO FIX THIS TECH DEBT. SO, THAT ALL DEPENDENCIES ARE GETTING FETCHED FORM NEXUS
  • OPEN A JIRA ISSUE FOR THE SAME

dependencies {
compile "org.grails.plugins:aws-sdk:1.10.44"
}

repositories {
mavenLocal()

maven {
    credentials {
        username 'vishal'
        password 'London01'
    }
    url "https://sonarqube.qvmonarch.co.nz/nexus/repository/grails-plugins/"
}

}

dependencyManagement {
imports {
mavenBom "org.grails:grails-bom:$grailsVersion"
}
applyMavenExclusions false
}

dependencies {
compile "org.springframework.boot:spring-boot-starter-logging"
compile "org.springframework.boot:spring-boot-autoconfigure"
compile "org.grails:grails-core"
compile "org.springframework.boot:spring-boot-starter-actuator"
compile "org.springframework.boot:spring-boot-starter-tomcat"
compile "org.grails:grails-dependencies"
compile "org.grails:grails-web-boot"
compile "org.grails.plugins:cache"
compile "org.grails.plugins:scaffolding"
compile "org.grails.plugins:hibernate4"
compile "org.hibernate:hibernate-ehcache"
compile "org.grails:grails-datastore-rest-client:5.0.5.RELEASE"
compile "org.grails.plugins:elasticsearch:1.0.0.2"
// compile "org.grails.plugins:aws-sdk:1.10.44"
compile "org.grails.plugins:quartz:2.0.1"
compile 'com.auth0:auth0-spring-mvc:0.0.1'
compile group: 'javax.servlet', name: 'jstl', version: '1.2'
compile'org.codehaus.groovy.modules.http-builder:http-builder:0.5.0'

console "org.grails:grails-console"
profile "org.grails.profiles:web:3.1.5"
runtime "org.grails.plugins:asset-pipeline"
runtime "com.h2database:h2"
runtime "org.postgresql:postgresql:9.4-1204-jdbc42"
runtime "org.grails.plugins:grails-melody-plugin:1.60.1"
runtime "com.thoughtworks.xstream:xstream:1.4.9"

testCompile "org.gebish:geb-spock:0.9.0-RC-1"
testCompile "org.grails:grails-plugin-testing"
testCompile "org.grails.plugins:geb"
testCompile "com.github.tomakehurst:wiremock:2.0.10-beta"
testCompile "com.github.tomjankes:wiremock-groovy:0.2.0"
testCompile "org.elasticmq:elasticmq-server_2.11:0.9.3"
testCompile "org.grails:grails-datastore-test-support:6.0.0.M1"
testCompile group: 'org.spockframework', name: 'spock-core', version: '1.1-groovy-2.4-rc-2'
testRuntime "org.seleniumhq.selenium:selenium-htmlunit-driver:2.47.1"
testRuntime "net.sourceforge.htmlunit:htmlunit:2.18"

}

task wrapper(type: Wrapper) {
gradleVersion = gradleWrapperVersion
}

assets {
minifyJs = false
minifyCss = false
}

grails {
agent {
enabled = false
}
// Pathing Jar fixes the file length exceeding command line character limit issue in Windows
pathingJar = true
}

test {
forkEvery 1
ignoreFailures = true
}

docker {
maintainer 'Tenzing "[email protected]"'
}

task docker(type: Docker, dependsOn: build) {
// push = true
// applicationName = jar.baseName
applicationName = "property-service"
// tagVersion = "1.0"
dockerfile = file('src/main/docker/Dockerfile')
doFirst {
copy {
from war
into stageDir
}
}
}

autobump pre-release

Pre-release version increment is really helpful in many cases. But currently there seems to be no way to auto bump the pre-release version based on matching commit message. There can be a preReleasePattern for the autobump setting just like other patterns - majorPattern, minorPattern, patchPattern, newPreReleasePattern, promoteToReleasePattern.

Authentication required for pushing git tag

When I invoke task tag with option --push, I always get the following error:
Authentication is required but no CredentialsProvider has been registered

How do I need to specify my credentials for the remote git repository?

Version number after checking out a tag and making changes should be scoped to the major-minor version from that tag

When someone checks out a tag and makes changes, the plugin calculates the new version using the latest version overall. Instead, the latest version should be scoped to the major and minor version from that tag. For example, suppose we have tags 2.0.0, 1.2.2, 1.2.1, 1.2.0 and we check out 1.2.0 and make changes. If we bump the patch-version for example, the new version should be 1.2.3 instead of 2.0.1.

Only supports JDK 8 and higher?

The default JDK on my CI machine is Java 7 so I get this stacktrace when I attempt to run any gradle task with this plugin installed:

com.google.common.util.concurrent.ExecutionError: java.lang.UnsupportedClassVersionError: net/vivin/gradle/versioning/SemanticBuildVersioningPlugin : Unsupported major.minor version 52.0
    at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2199)
    at com.google.common.cache.LocalCache.get(LocalCache.java:3934)
    at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3938)
    at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4821)
    at org.gradle.api.internal.plugins.DefaultPluginRegistry.uncheckedGet(DefaultPluginRegistry.java:149)
    at org.gradle.api.internal.plugins.DefaultPluginRegistry.lookup(DefaultPluginRegistry.java:144)
    at org.gradle.api.internal.plugins.DefaultPluginRegistry.lookup(DefaultPluginRegistry.java:127)
    at org.gradle.api.internal.plugins.DefaultPluginManager.apply(DefaultPluginManager.java:108)
    at org.gradle.plugin.use.internal.DefaultPluginRequestApplicator$5.run(DefaultPluginRequestApplicator.java:170)
    at org.gradle.plugin.use.internal.DefaultPluginRequestApplicator.applyPlugin(DefaultPluginRequestApplicator.java:204)
    at org.gradle.plugin.use.internal.DefaultPluginRequestApplicator.applyPlugins(DefaultPluginRequestApplicator.java:168)
    at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:157)
    at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:38)
    at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:25)
    at org.gradle.configuration.project.ConfigureActionsProjectEvaluator.evaluate(ConfigureActionsProjectEvaluator.java:34)
    at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:55)
    at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:540)
    at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:93)
    at org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(TaskPathProjectEvaluator.java:42)
    at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:35)
    at org.gradle.initialization.DefaultGradleLauncher$2.run(DefaultGradleLauncher.java:124)
    at org.gradle.internal.Factories$1.create(Factories.java:22)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:53)
    at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:121)
    at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:32)
    at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:98)
    at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:92)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:63)
    at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:92)
    at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:83)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:99)
    at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
    at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:48)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:30)
    at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:81)
    at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:46)
    at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:51)
    at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:28)
    at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:43)
    at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:173)
    at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:239)
    at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:212)
    at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)
    at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
    at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
    at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
    at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:205)
    at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
    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(ProcessBootstrap.java:55)
    at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:36)
    at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
    at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:30)
    at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:129)
    at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
Caused by: java.lang.UnsupportedClassVersionError: net/vivin/gradle/versioning/SemanticBuildVersioningPlugin : Unsupported major.minor version 52.0
    at org.gradle.api.internal.plugins.DefaultPluginRegistry$1.load(DefaultPluginRegistry.java:71)
    at org.gradle.api.internal.plugins.DefaultPluginRegistry$1.load(DefaultPluginRegistry.java:51)
    at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3524)
    at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2317)
    at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2280)
    at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2195)
    ... 58 more

In my opinion there should be support for at least JDK 7. I'd be happy to submit a PR if anyone has any guidance on how to make this possible....if it's anything other than changing https://github.com/vivin/gradle-semantic-build-versioning/blob/master/build.gradle#L40-L41

Support Mono Repo

Currently we have a mono repo with multiple gradle sub projects
Each subproject has different versions which works fine with separate semantic-build-versioning.gradle files and using tagPrefix/tagPattern

The only issue we have is that any commit / change across the whole git repo
will cause a new version to be created/allowed for the subproject when what
would be better is to only check for commits/changes that affects files in the subproject directory and potentially some other folders.

Is this functionality something you could see the plugin to support?

project.version is no longer a String when this plugin is active

Even if I'm not using one of this plugin's tasks, when it is active project.version is a SemanticBuildVersion rather than a string. This is somewhat counterintuitive and could break code that interacts with project.version in users' build scripts. An example of the kind of code that breaks can be seen in this gradle discussion forum topic:
https://discuss.gradle.org/t/is-it-possible-using-new-maven-publish-plugin-to-select-repository-to-publish-to-based-on-version-release-vs-snapshot/3696/2

Here we see a legitimate use case for users to call String methods on project.version

version to not consistent

Hi there

I am quite new to gradle and trying to use the semantic build versioning in our project, but having problem when try to publish a zip file to nexus server in the child project

In the parent project, I publish the parent jar file to Nexus

..
        classpath "gradle.plugin.net.vivin:gradle-semantic-build-versioning:2.0.2"
...

apply plugin: 'net.vivin.gradle-semantic-build-versioning'
    project.version.with {
        startingVersion = '1.6.0'
}


uploadArchives {
    repositories {
        mavenDeployer {
            repository(url: NEXUS_RELEASE_URL) {
                authentication(userName: NEXUS_USER, password: NEXUS_PASSWORD)
            }
            snapshotRepository(url: NEXUS_SNAPSHOT_URL) {
                authentication(userName: NEXUS_USER, password: NEXUS_PASSWORD)
            }
        }
    }
}

In one of its child project, I tried to use maven publish plug to publish its zip distribution to nexus.

publishing {
    repositories {
        maven {
            url NEXUS_SNAPSHOT_URL
            credentials {
                username NEXUS_USER
                password NEXUS_PASSWORD
            }
        }
    }
    publications {
        mavenJava(MavenPublication) {
            from components.java

            artifactId 'content-aws-lambda'
            artifact buildZip
        }
    }
}

My current git tag is 1.5.0.

When try to run the version build
gradle clean bumpMinor build publish printVersion

It complains file not exist
_
Execution failed for task ':endpoints:amazon-lambda:publishMavenJavaPublicationToMavenRepository'.

Invalid publication 'mavenJava': artifact file does not exist: '/Users/xxx/xx/amazon-lambda/build/libs/amazon-lambda-1.5.1-SNAPSHOT.jar'_

I can see the files was built at libs/amazon-lambda-1.6.0-SNAPSHOT.jar, (I can also see amazon-lambda-1.6.0-SNAPSHOT.zip file was built in the distribution folder, which is the one I actually want to publish) but not sure why the publish still trying to find 1.5.1 version. It looks like it can only understand as a patch bump rather than minor bump.

I saw someone mentioned about the compatibility issue with Maven publish plugin, but not sure whether it is the case for me. Could you please advise how to solve this issue. Many thanks.

Incorrectly reporting working tree changes

I'm running into an issue where executing ./gradlew tag fails with "Cannot create a tag when there are uncommitted changes", but git status responds with "nothing to commit, working tree clean".

I believe this is the same issue what was reported here, which was apparently an issue with JGit and which was fixed in JGit 4.5.

I tried to test updating JGit to 4.5.0, but the fact that S3 is down means I can't get to all sorts of resources necessary to build the plugin locally (like plugins.gradle.org 😞 ).

Platform: OS X 10.11

Using the plugin

Hi Vivin,

it seams that your plugin does exactly what I need. But I did not make it work. Are there any examples which shows how to configure your plugin in the right way?

I called the task printVersion to see what version the next tag my have. But the value I got is not what I have expected.

Thank you

promote-to-release is not working

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.

Pushing tags to git throws "Authentication error"

Following error occurs when trying to use --push with the tag option. Please specify how/where to provide the credentials. This is happening on my Jenkins though.

Execution failed for task ':tag'.
> org.eclipse.jgit.api.errors.TransportException: https://my.hosted.git/some/project/name.git: Authentication is required but no CredentialsProvider has been registered

Error occurs here in the gradle-semantic-build-versioning plugin.

specify bump up minor by default

I would like to do something like

autobump {
    majorPattern = ~/(?m)^\[major-release\]$/
    patchPattern = ~/(?m)^hotfix$/
}

1: git commit -m "normal stuff" -> v1.1.0
2: git commit -m "hotfix" -> v1.1.1
3: git commit -m "[major-release]" -> v2.1.1

but when I do case 1 I get a bump in patch component, not minor

Unable to find Git repository

gradle-semantic-build-versioning requires the existence of a git directory. As a result, unless the user explicitly generates a git directory (e.g. via git init), gradle build fails. Is it possible to sidestep the requirement regarding the existence of git folder?

Please see the relevant issue here, and the relevant code here.

Thanks!

`startingVersion` property not respected in the `semantic-build-versioning.gradle` file

I inherited a Gradle plugin project from a previous developer that used a much older ('1.1.3') version of the plugin, and I just updated the project to use version 4.0.0. There were two tags on the plugin project ('0.1.0' and '0.2.0') when I pulled it from Git (with '0.2.0' being the tag on the version I checked out) and I haven't checked in any of my changes as of yet. I'm running Gradle v4.0.2 and Java v1.8.0_121 64-bit on a Linux machine.

When I run a clean build, the version on the plugin JAR is set to '0.1.1'.

If I run a build with the -PbumpComponent=minor property set, the version of the JAR is bumped to '0.2.0' as you would expect.

If I run a build with the PbumpComponent=major property set, the version of the JAR is bumped to '1.0.0' as you'd also expect.

My semantic-build-versioning.gradle file is empty, but if I set the startingVersion property in the file (say to '0.2.0' or '1.0.0') it doesn't seem to be respected at all. I would expect that setting the startingVersion property in that file would override any tags set on the project in Git or any other properties but it doesn't seem to work that way; is that correct or am I misunderstanding how the current version is computed?

Many thanks in advance!

Determination of truthiness of SemanticBuildVersion.snapshot seems counterintuitive

https://github.com/vivin/gradle-semantic-build-versioning/blob/434bf29bb9683874b06faf3f1052d6488cf6253b/src/main/groovy/net/vivin/gradle/versioning/SemanticBuildVersioningPlugin.groovy#L22

This appears to be the only way that SemanticBuilderVersion.snapshot can be false.

Yet, I would expect that if I am on a "release" tag (eg 0.1.1) the plugin should infer that it is not a snapshot. I also think it would be handy to issue a warning when the release task is used without the tag task AND the current git repo is not tagged with a release version.

Having problem to run gradle build in command line

I keep having this error message when I try to run the gradle build using command line, while no issues at all using IntelliJ

What went wrong: A problem occurred evaluating root project 'xxxxx'.
Failed to apply plugin [id 'net.vivin.gradle-semantic-build-versioning'] > Unable to find Git repository: Systen wide config file /usr/local/git/etc/gitconfig is invalid org.eclipse.jgit.errors.ConfigInvalidException: Cannot read file /usr/local/git/etc/gitconfig

The repository has been specified in the build.gradle file and build works fine with intelliJ.

maven {
            url "https://plugins.gradle.org/m2/"
}

I am not sure why it tries to check the gitconfig file and why it failed when I try to run it in command line

Thanks in advance

Open source license

Would it be possible to add a license to this project? For example the Apache 2.0 license.

Thanks!
Sean

Promote after pre-release doesn't seem to work

I am considering to use the plugin in one of our projects and am playing around with it to figure out how it works. Thereby I encountered the following issue:

Given the following (complete) git history:

6ce0191 (HEAD -> master) [promote]
3444194 [major]
e1f2e36 [minor]
91db0d1 [new-pre-release]

At 3444194 gradlew printVersion shows: 1.0.0-alpha.0-SNAPSHOT. That is a pre-release tag-name, as expected. However at 6ce0191 gradlew printVersion gives an error message:

$ ./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

From the documentation I interpret that in the default configuration you can switch between pre-release state and release state by "[new-pre-release]" and "[promote]", respectively. Should the result then not just be 1.0.0 in this situation (or maybe 1.0.0-SNAPSHOT)? Or am I getting something wrong about the working of the plugin?

In this context it might be relevant that I did not get pre-release numbering. If I extend the repository by a "continue" branch like this

* 904cd37 (HEAD -> continue) nothing
* 32ab94d nothing
* dbb0192 nothing
| * 6ce0191 (master) [promote]
| * 3444194 [major]
| * e1f2e36 [minor]
|/  
* 91db0d1 [new-pre-release]

Then doing ./gradlew printVersion on 904cd37 shows "0.1.0-alpha.0-SNAPSHOT". What I'd (naïvely) expect of a plugin would be that e.g. "alpha.0" gets increased to "alpha.1" and so on with non-"[promote]" commits like here. Is this also the behaviour that is intended by the example in the readme?

Finally, it seems that the closure in preRelease { bump = ... } never gets executed. At least System.err.println or throws do not result in gradlew --debug output.

It all seems like that all commits since the 91db0d1 commit get interpreted as "[new-pre-release]" commits.

I'd be grateful for some support in this issue or clarification about the working of the plugin!

Here are my configuration files:

  • build.gradle:
task wrapper(type: Wrapper) {
    gradleVersion = '4.2.1'
}
  • settings.gradle:
rootProject.name = "test"

buildscript {
    repositories {
        maven {
            url "https://plugins.gradle.org/m2/"
        }
    }
    dependencies {
        // The configuration of this plugin is in semantic-build-versioning.gradle.
        classpath group: 'gradle.plugin.net.vivin', name: 'gradle-semantic-build-versioning', version: '4.0.0'
    }
}

apply plugin: 'net.vivin.gradle-semantic-build-versioning'    // MIT
  • semantic-build-versioning.gradle:
tagPattern = ~/^\d+\.\d+\.\d+(?:-\S+)?$/

preRelease {
    startingVersion = 'alpha.0'

    // The bumping scheme is alpha.0 -> alpha.1 -> ... -> alpha.n
    bump = {
        "alpha.${((it - ~/^alpha\./) as int) + 1}"
    }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.