gradle-jgitver-plugin icon indicating copy to clipboard operation
gradle-jgitver-plugin copied to clipboard

Gradle jgitver configuration to automatically increase minor version

Open rivancic opened this issue 1 year ago • 0 comments

I want that on the development branch version automatically gets increased by minor version as mostly commits do include new functionality. With default configuration patch version gets increased.

current latest tag is 1.4.0.

jgitver {
  strategy = 'MAVEN'
  nonQualifierBranches = "master,develop" // Dont add branch names to version when on specified branches.
}

resulting in 1.4.1

If I try to configure a pattern so that the NEXT_MINOR_VERSION would be take I get exception in version calculation For example this works

jgitver {
  strategy = fr.brouillard.oss.jgitver.Strategies.PATTERN
  versionPattern("\${meta.CURRENT_VERSION_MAJOR}.\${meta.CURRENT_VERSION_MINOR}.\${meta.CURRENT_VERSION_PATCH}")
  nonQualifierBranches = "master,develop" // Dont add branch names to version when on specified branches.
}

resulting in 1.4.0

while with changing the minor version to ${meta.NEXT_MINOR_VERSION}

jgitver {
  strategy = fr.brouillard.oss.jgitver.Strategies.PATTERN
  versionPattern("\${meta.CURRENT_VERSION_MAJOR}.\${meta.NEXT_MINOR_VERSION}.\${meta.CURRENT_VERSION_PATCH}")
  nonQualifierBranches = "master,develop" // Dont add branch names to version when on specified branches.
}

I get following exception

Caused by: fr.brouillard.oss.jgitver.impl.VersionCalculationException: cannot compute version
        at fr.brouillard.oss.jgitver.impl.PatternVersionStrategy.build(PatternVersionStrategy.java:122)
        at fr.brouillard.oss.jgitver.impl.GitVersionCalculatorImpl.buildVersion(GitVersionCalculatorImpl.java:341)
        ... 202 more
Caused by: java.lang.IllegalStateException: cannot parse 1..0 as a semver compatible version
        at fr.brouillard.oss.jgitver.Version.parse(Version.java:154)

Using latest stable version (quite old) 0.9.1, tried with 0.10.0-rc03 as well with the same result.

rivancic avatar Aug 08 '24 09:08 rivancic