Skip to content

Gradle jgitver configuration to automatically increase minor version #38

@rivancic

Description

@rivancic

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions