Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gradle jgitver configuration to automatically increase minor version #38

Open
rivancic opened this issue Aug 8, 2024 · 0 comments
Open

Comments

@rivancic
Copy link

rivancic commented Aug 8, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant