I’m using jgitver gradle plugin -> https://github.com/jgitver/gradle-jgitver-plugin
Using latest stable version (quite old) 0.9.1, tried with 0.10.0-rc03 as well with the same result.
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)
I’m missing to find any concrete examples of defining patterns or documentation.
Alternative
Is this possible with any other Gradle plugin. Note I have multimodule build, should work for the artifacts in submodules as well.